Beispiel #1
0
 /// <summary>
 /// Edit
 /// </summary>
 /// <param name="bk">Class</param>
 /// <returns>int</returns>
 public static int Edit(BookInfo bk)
 {
     try
     {
         using (BookDB_Model BkDB = new BookDB_Model())
         {
             BkDB.Entry(bk).State = System.Data.Entity.EntityState.Modified;
             return(BkDB.SaveChanges());
         }
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Add
 /// </summary>
 /// <param name="bk">Class</param>
 /// <returns>int</returns>
 public static int Add(BookInfo bk)
 {
     try
     {
         using (BookDB_Model BkDB = new BookDB_Model())
         {
             BkDB.BookInfo.Add(bk);
             return(BkDB.SaveChanges());
         }
     }
     catch (Exception error)
     {
         throw error;
     }
 }
Beispiel #3
0
 /// <summary>
 /// Delete
 /// </summary>
 /// <param name="id">ID</param>
 /// <returns>int</returns>
 public static int Del(int id)
 {
     try
     {
         using (BookDB_Model BkDB = new BookDB_Model())
         {
             BkDB.BookInfo.Remove(BkDB.BookInfo.Find(id));
             return(BkDB.SaveChanges());
         }
     }
     catch (Exception error)
     {
         throw error;
     }
 }