コード例 #1
0
 public ActionResult Edit([Bind(Include = "UserId,Name,Address,Contact")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "BookId,Title,SerialNumber,Author,Publisher,qty,IsAvailable")] Books books)
 {
     if (ModelState.IsValid)
     {
         db.Entry(books).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index2"));
     }
     return(View(books));
 }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "BorrowHistoryId,BookId,UserId,BorrowDate,ReturnDate")] BorrowHistory borrowHistory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(borrowHistory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BookId = new SelectList(db.Mybooks, "BookId", "Title", borrowHistory.BookId);
     ViewBag.UserId = new SelectList(db.Users, "UserId", "Name", borrowHistory.UserId);
     return(View(borrowHistory));
 }