public void PenaltyToZero(int id) { Penalty pn = cont.PenaltySet.Find(id); if (pn != null) { pn.Sum = 0; cont.SaveChanges(); } }
public void Add(BookGiving BG, BookReturning BR) { try { if (BG != null && BR != null) { Librarian curL = (from t in cont.PersonSet where BR.Librarian.Id == t.Id select t as Librarian).First(); BG.BookReturning = new BookReturning(); BG.BookReturning.Librarian = curL; Penalty pn = new Penalty(); pn.Info = BR.Penalty.Info; pn.Sum = BR.Penalty.Sum; BG.BookReturning.Penalty = pn; BG.BookReturning.Real_Return_Date = BR.Real_Return_Date; BG.Publication.Available = true; cont.SaveChanges(); } } catch { } }