public ActionResult Edit([Bind(Include = "Id,Name,Surname")] Author author, [Bind(Include = "Id,Title,ISBN,ReleaseDate,AuthorId")] Book book, string rodzaj) { if (rodzaj == "ksiazka") { db.Entry(book).State = EntityState.Modified; db.SaveChanges(); } else { db.Entry(author).State = EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,AuthorId,Title,ISBN,ReleaseDate")] Book book) { if (ModelState.IsValid) { db.Entry(book).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(book)); }
public ActionResult Edit([Bind(Include = "ClientID,ClientFirstName,ClientLastName,Password,Age")] Client client) { if (ModelState.IsValid) { db.Entry(client).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(client)); }
public ActionResult Edit([Bind(Include = "BrandID,BrandName")] Brand brand) { if (ModelState.IsValid) { db.Entry(brand).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(brand)); }
public ActionResult Edit([Bind(Include = "AuthorID,AuthorName")] Author author) { if (ModelState.IsValid) { db.Entry(author).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(author)); }
public ActionResult Edit([Bind(Include = "ManagerID,ManagerName,ManagerPassword")] Manager manager) { if (ModelState.IsValid) { db.Entry(manager).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(manager)); }
public ActionResult Edit([Bind(Include = "BookID,BookName,BookGenre,Stock,AuthorID")] Book book) { if (ModelState.IsValid) { db.Entry(book).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AuthorID = new SelectList(db.Authors, "AuthorID", "AuthorName", book.AuthorID); return(View(book)); }
public ActionResult Edit([Bind(Include = "LoansID,StudentID,BookID,Active")] Loans loans) { if (ModelState.IsValid) { db.Entry(loans).State = EntityState.Modified; if (!loans.Active) { db.Books.Find(loans.BookID).Stock++; } else { db.Books.Find(loans.BookID).Stock--; } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BookID = new SelectList(db.Books, "BookID", "BookName", loans.BookID); ViewBag.StudentID = new SelectList(db.Students, "StudentID", "StudenFirstName", loans.StudentID); return(View(loans)); }