Пример #1
0
 public static void addBookToMybasket(MyBasketOfBooks bas)
 {
     try
     {
         using (BooksLibraryProjectEntities db = new BooksLibraryProjectEntities())
         {
             db.MyBasketOfBooks.Add(bas);
             //????????????????????????????????????????????????????
             db.SaveChanges();
         }
         return;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #2
0
 public static void deleteBookFromMyBuskate(int idB, int idU)
 {
     try
     {
         using (BooksLibraryProjectEntities db = new BooksLibraryProjectEntities())
         {
             List <MyBasketOfBooks> busketList = db.MyBasketOfBooks.Where(x => x.idUser == idU).ToList();
             if (busketList.Count > 0)
             {
                 MyBasketOfBooks busketBookToRemove = busketList.Where(x => x.idBook == idB).FirstOrDefault();
                 if (busketBookToRemove != null)
                 {
                     db.MyBasketOfBooks.Remove(busketBookToRemove);
                     db.SaveChanges();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }