Ejemplo n.º 1
0
        public void Add(BookGiving bg)
        {
            Reader      curR = (from t in cont.PersonSet where bg.Reader.Id == t.Id select t as Reader).First();
            Librarian   curL = (from t in cont.PersonSet where bg.Librarian.Id == t.Id select t as Librarian).First();
            Publication curP = (from t in cont.PublicationSet where t.Id == bg.Publication.Id select t).First();

            bg.Reader      = curR;
            bg.Librarian   = curL;
            bg.Publication = curP;
            cont.BookGivingSet.Add(bg);
            curP.Available = false;
            cont.SaveChanges();
        }
Ejemplo n.º 2
0
 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 { }
 }