public void Delete(int id) { using (var db = new DbContext()) { Entities.CarcassRevenue carcassRevenue = db.CarcassRevenue.Single(x => x.Id == id); db.CarcassRevenue.Remove(carcassRevenue); db.SaveChanges(); } }
public void Update(CarcassRevenueDto dto) { using (var db = new DbContext()) { Entities.CarcassRevenue carcassRevenue = db.CarcassRevenue.Single(x => x.Id == dto.Id); carcassRevenue.HuntedGameId = dto.HuntedGameId; carcassRevenue.Revenue = dto.Revenue; carcassRevenue.CarcassWeight = dto.CarcassWeight; db.SaveChanges(); } }
public void Insert(CarcassRevenueDto dto) { var entity = new Entities.CarcassRevenue { HuntedGameId = dto.HuntedGameId, Revenue = dto.Revenue, CarcassWeight = dto.CarcassWeight }; using (var db = new DbContext()) { db.CarcassRevenue.Add(entity); db.SaveChanges(); } }