You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

67 lines
1.4 KiB

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
}
}