Example #1
0
 public void UpdateBook(Model.Book p)
 {
     DAL.Book tmp = db.Book.GetItem(p.Id);
     tmp.Status_id = p.Status_id;
     db.Book.Update(tmp);
     Save();
 }
Example #2
0
 public void Book_status_change(Model.Book p, int stat_id)
 {
     DAL.Book tmp = db.Book.GetItem(p.Id);
     tmp.Status_id = stat_id;
     db.Book.Update(tmp);
     Save();
 }
Example #3
0
 public int AddBook(Book book)
 {
     int addedBookId;
     using (var context = new LibraryEntities())
     {
         context.Books.Add(book);
         context.SaveChanges();
         addedBookId = book.Id;
     }
     return addedBookId;
 }
Example #4
0
 public Model.Book GetBook(int BookId)
 {
     DAL.Book tmp = db.Book.GetItem(BookId);
     return(new Model.Book(tmp, db.Izdatelstvo.GetItem(tmp.Izdatelstvo_id), db.Book_status.GetItem(tmp.Status_id), db.Rubrika.GetItem(tmp.Rubrika_id)));
 }
Example #5
0
 private void printBook(Book book)
 {
     Console.WriteLine
         (
             String.Format("Title: {0} \nDescription: {1} \nAuthor: {2} \nCategory: {3} \nPrice: {4}\nID: {5}",
             book.Title,
             book.Descriptn,
             (book.Author.First_name + " " + book.Author.Last_name),
             book.Category.Name,
             book.Price,
             book.Id)
         );
 }