Ejemplo n.º 1
0
        // GET: ProductType/Create
        public IActionResult Create()
        {
            CreateProducttypeViewModel viewModel = new CreateProducttypeViewModel();

            viewModel.ProductType = new ProductType();
            return(View(viewModel));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create(CreateProducttypeViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(viewModel.ProductType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(viewModel));
        }