// GET: ProductType/Create public IActionResult Create() { CreateProducttypeViewModel viewModel = new CreateProducttypeViewModel(); viewModel.ProductType = new ProductType(); return(View(viewModel)); }
public async Task <IActionResult> Create(CreateProducttypeViewModel viewModel) { if (ModelState.IsValid) { _context.Add(viewModel.ProductType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(viewModel)); }