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(); }
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(); }
public int AddBook(Book book) { int addedBookId; using (var context = new LibraryEntities()) { context.Books.Add(book); context.SaveChanges(); addedBookId = book.Id; } return addedBookId; }
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))); }
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) ); }