Example #1
0
 public ActionResult Edit([Bind(Include = "majorId,majorName")] Major major)
 {
     if (ModelState.IsValid)
     {
         db.Entry(major).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(major));
 }
 public ActionResult Edit([Bind(Include = "stuId,ISBN,stuName,Title,date_issue,date_due_for_return,date_return,date_late,fine_paid")] vBookDetail vBookDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vBookDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vBookDetail));
 }
 public ActionResult Edit([Bind(Include = "catId,catName")] BookCategory bookCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bookCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bookCategory));
 }
 public ActionResult Edit([Bind(Include = "stuId,username,password,stuName,stuPhone,stuEmail,stuAddress,majorId")] Student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.majorId = new SelectList(db.Majors, "majorId", "majorName", student.majorId);
     return(View(student));
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "book_borrowing_id,ISBN,stuId,date_issue,date_due_for_return,date_return,status")] Book_Out_on_loan book_Out_on_loan)
 {
     if (ModelState.IsValid)
     {
         db.Entry(book_Out_on_loan).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ISBN  = new SelectList(db.Books, "ISBN", "Title", book_Out_on_loan.ISBN);
     ViewBag.stuId = new SelectList(db.Students, "stuId", "username", book_Out_on_loan.stuId);
     return(View(book_Out_on_loan));
 }
Example #6
0
 public ActionResult Edit([Bind(Include = "ISBN,Title,Author,Image,Price,Description,Category")] Book book, HttpPostedFileBase fileUpload)
 {
     if (fileUpload == null)
     {
         ViewBag.ThongBao = "Please choose image";
         return(View());
     }
     if (ModelState.IsValid)
     {
         var    fileName = Path.GetFileName(fileUpload.FileName);
         string folder   = Server.MapPath("~/Images/");
         book.Image           = "~/Images/" + fileName;
         db.Entry(book).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Category = new SelectList(db.BookCategories, "catId", "catName", book.Category);
     return(View(book));
 }