Ejemplo n.º 1
0
        public string Create(Book book)
        {
            var db = new BookstoreDb();

            db.Create(book);

            return(db.RunOnConnectionError ?? "Book was Created !!!");
        }
Ejemplo n.º 2
0
        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"));
        }