|
|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace Sevomin.Models.Repositories
- {
- public class ParameterRepository: IParameterRepository
- {
-
- #region Singleton
- private static ParameterRepository member;
- private static object locker = new object();
-
- private ParameterRepository()
- {
- }
-
- static ParameterRepository()
- {
- lock (locker)
- {
- ParameterRepository.member = new ParameterRepository();
- }
- }
- public static ParameterRepository Current
- {
- get
- {
- return ParameterRepository.member;
- }
-
- }
- #endregion
-
- #region JobRepository
-
- public IQueryable<Parameter> ListAll()
- {
- return SevominDbContext.Current.Parameters;
- }
-
- public Parameter Find(long key)
- {
- return ListAll().SingleOrDefault(d => d.Id == key);
- }
-
- public void Delete(Parameter d)
- {
- SevominDbContext.Current.Parameters.Remove(d);
- Save();
- }
-
- public void Add(Parameter d)
- {
- SevominDbContext.Current.Parameters.Add(d);
- Save();
- }
-
- public void Save()
- {
- SevominDbContext.Current.SaveChanges();
- }
- #endregion
- }
- }
|