public ActionResult BorrowIndex(int bookid, int userid, Borrowed borrowed) { borrowed.BookID = bookid; borrowed.UserID = userid; db.Borroweds.Add(borrowed); db.SaveChanges(); olvm.borrowedsList = db.Borroweds.Where(x => x.UserID == userid).ToList(); return(View(olvm)); }
public ActionResult Create([Bind(Include = "BookID,Title,Author,Genre,Description,DateAdded,DateModified")] Book book) { if (ModelState.IsValid) { db.Books.Add(book); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(book)); }
public ActionResult Create([Bind(Include = "UserID,FirstName,LastName,Role,Username,Password")] User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return(RedirectToAction("Home", "Login")); } return(View(user)); }