public async Task <Subcategory> Delete(long code) { var obj = await _subcategoryRepository.GetByCode(code); if (obj != null) { return(await _subcategoryRepository.Delete(obj.Id.GetValueOrDefault())); } return(obj); }
public async Task <Subcategory> DeleteAsync(int id) { var subcategory = await FindAsync(id); _subcategoryRepository.Delete(subcategory); await _unitOfWork.SaveChangesAsync(); return(subcategory); }
public ActionResult Delete(int id) { try { _subcategoryRepository.Delete(id); } catch (DbUpdateException e) { return(View("_Error", new string[] { "Move products to other category." })); } return(RedirectToAction("Index")); }
public void Delete(int Id) { Subcategory subcategory = _subcategoriesRepository.GetById(Id); _subcategoriesRepository.Delete(subcategory); }