public ActionResult DeleteConfirmed(int id)
        {
            bookLocation bookLocation = db.bookLocations.Find(id);

            db.bookLocations.Remove(bookLocation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
        public IActionResult Put(int id, [FromBody] bookLocation bookLocation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            db.Entry(bookLocation).State = EntityState.Modified;
            db.SaveChanges();
            return(AcceptedAtAction("Get", new { id = bookLocation.bookID }, bookLocation));
        }
示例#3
0
        public IActionResult Post([FromBody] bookLocation bookLocation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            db.bookLocations.Add(bookLocation);
            db.SaveChanges();
            return(CreatedAtAction("Post", new { id = bookLocation.bookID }, bookLocation));
        }
 public ActionResult Edit([Bind(Include = "bookStoreNumber,bookID,bookStoreLocation,bookShelve,bookPhysical")] bookLocation bookLocation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bookLocation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.bookID = new SelectList(db.bookInfo, "bookID", "bookName", bookLocation.bookID);
     return(View(bookLocation));
 }
        // GET: bookLocations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            bookLocation bookLocation = db.bookLocations.Find(id);

            if (bookLocation == null)
            {
                return(HttpNotFound());
            }
            return(View(bookLocation));
        }
        // GET: bookLocations/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            bookLocation bookLocation = db.bookLocations.Find(id);

            if (bookLocation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.bookID = new SelectList(db.bookInfo, "bookID", "bookName", bookLocation.bookID);
            return(View(bookLocation));
        }