public void Delete(int id) { using (var db = new DbContext()) { Entities.Labor labor = db.Labor.Single(x => x.Id == id); db.Labor.Remove(labor); db.SaveChanges(); } }
public void Update(LaborDto dto) { using (var db = new DbContext()) { Entities.Labor labor = db.Labor.Single(x => x.Id == dto.Id); labor.HuntsmanId = dto.HuntsmanId; labor.Description = dto.Description; labor.Date = dto.Date; db.SaveChanges(); } }
public void Insert(LaborDto dto) { var entity = new Entities.Labor { HuntsmanId = dto.HuntsmanId, Description = dto.Description, Date = dto.Date }; using (var db = new DbContext()) { db.Labor.Add(entity); db.SaveChanges(); } }