Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public async Task <Subcategory> DeleteAsync(int id)
        {
            var subcategory = await FindAsync(id);

            _subcategoryRepository.Delete(subcategory);

            await _unitOfWork.SaveChangesAsync();

            return(subcategory);
        }
Exemplo n.º 3
0
        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"));
        }
Exemplo n.º 4
0
 public void Delete(int Id)
 {
     Subcategory subcategory = _subcategoriesRepository.GetById(Id);
     _subcategoriesRepository.Delete(subcategory);
 }