public ActionResult Create([Bind(Include = "majorId,majorName")] Major major) { if (ModelState.IsValid) { db.Majors.Add(major); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(major)); }
public ActionResult Create([Bind(Include = "stuId,ISBN,stuName,Title,date_issue,date_due_for_return,date_return,date_late,fine_paid")] vBookDetail vBookDetail) { if (ModelState.IsValid) { db.vBookDetails.Add(vBookDetail); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vBookDetail)); }
public ActionResult Create([Bind(Include = "catId,catName")] BookCategory bookCategory) { if (ModelState.IsValid) { db.BookCategories.Add(bookCategory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(bookCategory)); }
public ActionResult Create([Bind(Include = "stuId,username,password,stuName,stuPhone,stuEmail,stuAddress,majorId")] Student student) { if (ModelState.IsValid) { db.Students.Add(student); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.majorId = new SelectList(db.Majors, "majorId", "majorName", student.majorId); return(View(student)); }
public ActionResult Create([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.Book_Out_on_loan.Add(book_Out_on_loan); 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)); }
public ActionResult Create([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); book.Image = "~/Images/" + fileName; db.Books.Add(book); db.SaveChanges(); return(RedirectToAction("Index")); } return(PartialView("Create", book)); }