public ActionResult Delete(int?id) { var db = new BookstoreDb(); var publishers = db.GetPublishers().Where(i => i.Id == id).FirstOrDefault(); return(View(publishers)); }
public string Create(Book book) { var db = new BookstoreDb(); db.Create(book); return(db.RunOnConnectionError ?? "Book was Created !!!"); }
// GET: Book public ActionResult Index() { var db = new BookstoreDb(); var books = db.GetBooks(); return(View(books.ToList())); }
// GET: Publisher // GET: Publisher public ActionResult Index() { var db = new BookstoreDb(); var publishers = db.GetPublishers(); return(View(publishers.ToList())); }
public ActionResult DeleteConfirmed(int id) { var db = new BookstoreDb(); db.DeletePublisher(id); return(RedirectToAction("Index")); }
// GET: Book/Delete/5 public ActionResult Delete(int?id) { var db = new BookstoreDb(); db.DeleteBook(id.GetValueOrDefault()); var books = db.GetBooks().Where(i => i.Id == id).FirstOrDefault(); return(View(books)); }
// GET: Publisher public ActionResult Index() { var db = new BookstoreDb(); var publishers = db.GetPublishers(); ViewBag.PageTitle = "Publisher list"; return(View(publishers.ToList())); }
public ActionResult Create([Bind(Include = "Name")] Publisher publisher) { if (string.IsNullOrWhiteSpace(publisher.Name)) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var db = new BookstoreDb(); db.Create(publisher); if (!string.IsNullOrWhiteSpace(db.RunOnConnectionError)) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); } return(RedirectToAction("Index")); }
public ActionResult Create() { var db = new BookstoreDb(); return(View()); }