EnVisageOnline/Main-RMO/Source/EnVisage/Code/BLL/UOMManager.cs

40 lines
919 B
C#

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using EnVisage.Models;
namespace EnVisage.Code.BLL
{
public class UOMManager : ManagerBase<UOM, UOMModel>
{
public UOMManager(EnVisageEntities dbContext)
: base(dbContext)
{
}
protected override UOM InitInstance()
{
return new UOM { Id = Guid.NewGuid() };
}
protected override UOM RetrieveReadOnlyById(Guid key)
{
return DataTable.AsNoTracking().FirstOrDefault(t => t.Id == key);
}
public override DbSet<UOM> DataTable
{
get
{
return DbContext.UOMs;
}
}
// SA. ENV-1218
public Dictionary<Guid, UOM> GetAsDictionary()
{
return DbContext.UOMs.AsNoTracking().ToDictionary(k => k.Id, v => v);
}
}
}