Ejemplo n.º 1
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            DeleteProducttypeViewModel viewModel = new DeleteProducttypeViewModel();

            viewModel.ProductType = await _context.productTypes.FindAsync(id);

            _context.productTypes.Remove(viewModel.ProductType);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 2
0
        // GET: ProductType/Delete/5
        public async Task <IActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            DeleteProducttypeViewModel viewModel = new DeleteProducttypeViewModel();

            viewModel.ProductType = await _context.productTypes
                                    .FirstOrDefaultAsync(m => m.ProductTypeID == id);

            if (viewModel.ProductType == null)
            {
                return(NotFound());
            }

            return(View(viewModel));
        }