public IActionResult Create(Category category) { if (ModelState.IsValid) { _repository.Save(category); _context.SaveChanges(); return(PartialView("_CategoryModalPartial", category)); } return(PartialView("_CategoryModalPartial", category)); }
public IActionResult Create(Store store) { if (ModelState.IsValid) { _repository.Save(store); _context.SaveChanges(); return(PartialView("_CreateStoreModalPartial", store)); } return(PartialView("_CreateStoreModalPartial", store)); }
public IActionResult Create(Products product) { ViewData["CategoryId"] = new SelectList(_categoryRepository.GetCategories(), "Id", "Name"); ViewData["StoreId"] = new SelectList(_storeRepository.GetStores(), "Id", "Name"); if (ModelState.IsValid) { _repository.Save(product); _context.SaveChanges(); return(PartialView("_CreateProductModalPartial", product)); } return(PartialView("_CreateProductModalPartial", product)); }
public IActionResult Register(UserRegistrationModel userModel) { if (ModelState.IsValid) { _accountRepository.Register(userModel); _context.SaveChanges(); return(RedirectToAction(nameof(AccountController.Login), "Account")); } else { return(View()); } return(RedirectToAction(nameof(HomeController.Index), "Home")); }