// GET: Admin public ActionResult Index() { using (SomethingShopDB context = new SomethingShopDB()) { StoreItems = context.Items.ToList(); return(View(StoreItems)); } }
public ActionResult AddItemSubmit(StoreItem item) { using (SomethingShopDB context = new SomethingShopDB()) { context.Items.Add(item); context.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Confirm() { ViewBag.Title = "Registration Confirmed"; using (SomethingShopDB context = new SomethingShopDB()) { List <SiteUser> users = context.Users.ToList(); return(View(users)); } }
public ActionResult Submit(SiteUser regData) { using (SomethingShopDB context = new SomethingShopDB()) { if (context.Users.Find(regData.Email) != null) { ModelState.AddModelError("EmailAddress", "Account with that email address is already registered"); } if (ModelState.IsValid) { TempData.Add("FirstName", regData.FirstName); ViewBag.FirstName = regData.FirstName; context.Users.Add(regData); context.SaveChanges(); return(RedirectToAction("Confirm")); } else { return(View("Index")); } } }