Exemplo n.º 1
0
        public async Task <IActionResult> DeleteProductAsync(DeleteProductBindingModel model)
        {
            var(IsSuccessed, ErrorMsg) = await _productBLL.DeleteProductAsync(model.ID);

            return(Json(new
            {
                IsSuccessed,
                ErrorMsg
            }));
        }
Exemplo n.º 2
0
        public IActionResult Delete(DeleteProductBindingModel model)
        {
            int id = model.Id;

            using (this.Context)
            {
                Product product = this.Context.Products.Include(x => x.ProductType).FirstOrDefault(x => x.Id == id);

                this.Context.Products.Remove(product);
                this.Context.SaveChanges();

                return(RedirectToHome);
            }
        }