public ActionResult Create([Bind(Include = "Id,Publisher1")] Publisher publisher) { if (ModelState.IsValid) { db.Publishers.Add(publisher); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(publisher)); }
public ActionResult Create([Bind(Include = "Id,Genre1,Macro")] Genre genre) { if (ModelState.IsValid) { db.Genres.Add(genre); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(genre)); }
public ActionResult Create([Bind(Include = "Id,Email,EmailConfirmed,PasswordHash,SecurityStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName")] AspNetUser aspNetUser) { if (ModelState.IsValid) { db.AspNetUsers.Add(aspNetUser); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(aspNetUser)); }
public ActionResult Create([Bind(Include = "Id,Author1")] Author author) { if (ModelState.IsValid) { db.Authors.Add(author); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(author)); }
public ActionResult Create([Bind(Include = "Id,Narrator1")] Narrator narrator) { if (ModelState.IsValid) { db.Narrators.Add(narrator); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(narrator)); }
public ActionResult Create([Bind(Include = "Id,User_Id,Order_date")] C_Order c_Order) { if (ModelState.IsValid) { db.C_Order.Add(c_Order); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.User_Id = new SelectList(db.AspNetUsers, "Id", "Email", c_Order.User_Id); return(View(c_Order)); }
public ActionResult Create([Bind(Include = "Id,Title,Description,Price,Cost,Running_time,Abridged,Language,Release_date,Image,Author_Id,Genre_Id,Narrator_Id,Publisher_Id")] Audiobook audiobook) { if (ModelState.IsValid) { db.Audiobooks.Add(audiobook); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Author_Id = new SelectList(db.Authors, "Id", "Author1", audiobook.Author_Id); ViewBag.Genre_Id = new SelectList(db.Genres, "Id", "Genre1", audiobook.Genre_Id); ViewBag.Narrator_Id = new SelectList(db.Narrators, "Id", "Narrator1", audiobook.Narrator_Id); ViewBag.Publisher_Id = new SelectList(db.Publishers, "Id", "Publisher1", audiobook.Publisher_Id); return(View(audiobook)); }
public ActionResult Create([Bind(Include = "Id,User_Id,State,City,Zip_code,Card_number")] Credit_Card credit_Card) { if (ModelState.IsValid) { db.Credit_Card.Add(credit_Card); db.SaveChanges(); if (User.IsInRole("Administrator")) { return(RedirectToAction(actionName: "Index")); } else { return(RedirectToAction(actionName: "Index", controllerName: "Manage", routeValues: null)); } } ViewBag.User_Id = new SelectList(db.AspNetUsers, "Id", "Email", credit_Card.User_Id); return(View(credit_Card)); }
public ActionResult Payment(FormCollection values) { var order = new C_Order(); TryUpdateModel(order); var user = db.AspNetUsers.Single( u => u.Id == User.Identity.GetUserId() && u.Credit_Card != null); try { if (user.Credit_Card != null) { order.User_Id = User.Identity.GetUserId(); order.Order_date = DateTime.Now; order.Cart_Id = Cart.GetCartId(this.HttpContext); db.C_Order.Add(order); db.SaveChanges(); var cart = Cart.GetCart(this.HttpContext); return(RedirectToAction(actionName: "Complete", routeValues: new { id = order.Id })); } else { return(RedirectToAction(actionName: "Create", controllerName: "Credit_Card", routeValues: null)); } } catch { //Invalid - redisplay with errors return(View(order)); } }