Exemple #1
0
        public ActionResult Delete(int?id)
        {
            var db         = new BookstoreDb();
            var publishers = db.GetPublishers().Where(i => i.Id == id).FirstOrDefault();

            return(View(publishers));
        }
Exemple #2
0
        public string Create(Book book)
        {
            var db = new BookstoreDb();

            db.Create(book);

            return(db.RunOnConnectionError ?? "Book was Created !!!");
        }
Exemple #3
0
        // GET: Book
        public ActionResult Index()
        {
            var db = new BookstoreDb();

            var books = db.GetBooks();

            return(View(books.ToList()));
        }
Exemple #4
0
        // 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"));
        }
Exemple #6
0
        // 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));
        }
Exemple #7
0
        // 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"));
        }
Exemple #9
0
        public ActionResult Create()
        {
            var db = new BookstoreDb();

            return(View());
        }