コード例 #1
0
        public IActionResult Create(Category category)
        {
            if (ModelState.IsValid)
            {
                _repository.Save(category);
                _context.SaveChanges();
                return(PartialView("_CategoryModalPartial", category));
            }

            return(PartialView("_CategoryModalPartial", category));
        }
コード例 #2
0
ファイル: StoreController.cs プロジェクト: wingled22/Coreapp
        public IActionResult Create(Store store)
        {
            if (ModelState.IsValid)
            {
                _repository.Save(store);
                _context.SaveChanges();
                return(PartialView("_CreateStoreModalPartial", store));
            }

            return(PartialView("_CreateStoreModalPartial", store));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
 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"));
 }