public static void Create(PayAbsenceDTO payAbsence) { using (Entities db = new Entities()) { db.PayAbsences.Add(_CastDTO.DTOToPayAbsence(payAbsence)); db.SaveChanges(); } }
public static void Delete(PayAbsenceDTO payAbsence) { using (Entities db = new Entities()) { var pAbs = db.PayAbsences.FirstOrDefault(pa => pa.Id == payAbsence.Id); db.PayAbsences.Remove(pAbs); db.SaveChanges(); } }
public static void Update(PayAbsenceDTO payAbsence) { using (Entities db = new Entities()) { var pAbs = db.PayAbsences.FirstOrDefault(pa => pa.Id == payAbsence.Id); pAbs.Id = payAbsence.Id; pAbs.Name = payAbsence.Name; pAbs.IsStandart = payAbsence.IsStandart; db.SaveChanges(); } }