示例#1
0
 public void Delete(int categoryId)
 {
     //_categoryDal.Delete(this.GetById(categoryId));
     _categoryDal.Delete(new Category {
         CategoryId = categoryId
     });
 }
示例#2
0
        public IResult Remove(int categoryId)
        {
            Category toRemove = GetById(categoryId).Data;

            _categoryDal.Delete(toRemove);
            return(new SuccessResult(Messages.CategoryRemoved));
        }
示例#3
0
        public IResult Delete(Category category)
        {
            Category result = _categoryDal.Get(c => c.CategoryId == category.CategoryId);

            _categoryDal.Delete(result);
            return(new SuccessResult(Messages.CategoryDeleted));
        }
示例#4
0
 public int DeleteCategory(int Id)
 {
     _categoryDal.Delete(new Category {
         Id = Id
     });
     return(Id);
 }
示例#5
0
        public IResult Delete(Category category)
        {
            var result = _categoryDal.Get(c => c.Id == category.Id);

            _categoryDal.Delete(result);
            return(new SuccessResult(Messages.Categories.Delete(category.CategoryName)));
        }
示例#6
0
        public IResult Delete(int id)
        {
            var value = _categoryDal.Get(x => x.Id == id);

            _categoryDal.Delete(value);
            return(new SuccessResult());
        }
 public IResult Delete(int categoryId)
 {
     _categoryDal.Delete(new Category {
         Id = categoryId
     });
     return(new SuccessResult(Messages.SuccessDeleted));
 }
            public async Task <IResult> Handle(DeleteCategoryCommand request, CancellationToken cancellationToken)
            {
                var categoryToDelete = _categoryDal.Get(p => p.CategoryId == request.CategoryId);

                _categoryDal.Delete(categoryToDelete);
                await _categoryDal.SaveChangesAsync();

                return(new SuccessResult(Messages.Deleted));
            }
        public void Delete(Category category)
        {
            if (category == null)
            {
                throw new ArgumentNullException(nameof(category));
            }

            _categoryDal.Delete(category);
        }
示例#10
0
        public IResult Delete(int id)
        {
            if (_categoryDal.Get(x => x.Id == id) != null)
            {
                _categoryDal.Delete(x => x.Id == id);
                return(new Result(true, "Kategori Silindi"));
            }

            return(new Result(false, "Kategori Bulunamadı!"));
        }
示例#11
0
        public IResult Delete(Category category)
        {
            IResult result = BusinessRules.Run(CheckIfCategoryNameExists(category.CategoryName));

            if (result != null)
            {
                return(result);
            }
            _categoryDal.Delete(category);
            return(new SuccessResult(Messages.CategoryDeleted));
        }
示例#12
0
 public IDataResult <Category> Delete(Category category)
 {
     if (category != null)
     {
         return(new SuccessDataResult <Category>(_categoryDal.Delete(category), "Category deleted!"));
     }
     else
     {
         return(new ErrorDataResult <Category>(category, "Category could not be deleted!"));
     }
 }
示例#13
0
        public IResult DeleteCategoryById(int id)
        {
            var category = _categoryDal.Get(x => x.Id == id);

            if (category != null)
            {
                _categoryDal.Delete(category);
                return(new SuccessResult(Message.CategoryDeleted));
            }
            return(new ErrorResult(Message.CategoryDeleteFailed));
        }
示例#14
0
        public IResult Delete(Category category)
        {
            var result = _categoryDal.Get(c => c.CategoryId == category.CategoryId);

            if (result != null)
            {
                _categoryDal.Delete(category);
                return(new SuccessResult(Messages.Categories.Delete(category.CategoryName)));
            }
            return(new ErrorResult(Messages.NotFound));
        }
 public void Delete(Categories category)
 {
     try
     {
         _categoryDal.Delete(category);
     }
     catch
     {
         throw new Exception("Silme gerçekleşemedi");
     }
 }
示例#16
0
        public IResult DeleteCorrect(int id)
        {
            var category = _categoryDal.GetById(id);

            if (category.ArticleCategories == null || category.ArticleCategories.Count == 0)
            {
                _categoryDal.Delete(category);
                return(new SuccessResult(Messages.SUCCESS_DELETE));
            }
            return(new ErrorResult(Messages.ERROR_DELETE_HAVE_ARTICLE));
        }
示例#17
0
        public IActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            var category = _categoryDal.Get(x => x.Id == id);

            _categoryDal.Delete(category);
            return(Json(category));
        }
示例#18
0
 public IResult Delete(Category category)
 {
     try
     {
         _categoryDal.Delete(category);
     }
     catch (Exception exception)
     {
         return(new ErrorResult(exception.Message));
     }
     return(new SuccessResult(Messages.CategoryDeleted));
 }
示例#19
0
 public IResult Delete(Category category)
 {
     try
     {
         _categoryDal.Delete(category);
         return(new SuccessResult(Messages.SuccessDeleted));
     }
     catch (Exception)
     {
         return(new ErrorResult(Messages.ErrorDeleted));
     }
 }
 public IResult Delete(Category entity)
 {
     try
     {
         _categoryDal.Delete(entity);
         return(new SuccessResult("Category silindi"));
     }
     catch (Exception ex)
     {
         return(new ErrorResult(ex.ToString()));
     }
 }
示例#21
0
 public void DeleteCategory(int id)
 {
     if (id > 1)
     {
         _categoryDal.Delete(new Category {
             CategoryID = id
         });
     }
     else
     {
         throw new Exception("Hata oldu");
     }
 }
示例#22
0
 public bool DeleteCategory(int id)
 {
     try
     {
         var category = _categoryDal.Get(x => x.Id == id);
         _categoryDal.Delete(category);
         _categoryDal.Save();
         return(true);
     }
     catch (Exception exp)
     {
         return(false);
     }
 }
示例#23
0
        public bool Delete(int id)
        {
            var deleteObject = _categoryDal.GetOne(x => x.Id == id);

            if (deleteObject != null)
            {
                bool result = _categoryDal.Delete(deleteObject);
                if (result)
                {
                    return(true);
                }

                return(false);
            }
            return(false);
        }
示例#24
0
 public bool DeleteCategory(Category category)
 {
     try
     {
         var currentCategory = categoryDal.Get(x => x.Id == category.Id);
         if (currentCategory != null)
         {
             categoryDal.Delete(category);
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#25
0
 public EntityResult Delete(Category model)
 {
     try
     {
         if (_categoryDal.Delete(model))
         {
             return(new EntityResult("Başarılı", ResultState.Success));
         }
         else
         {
             return(new EntityResult("Hata Oluştu", ResultState.Warning));
         }
     }
     catch (Exception ex)
     {
         return(new EntityResult("Database Hatası " + ex.ToInnestException().Message, ResultState.Error));
     }
 }
示例#26
0
 public IResult Delete(int id)
 {
     try
     {
         var category = _categoryDal.Get(p => p.Id == id);
         var product  = _productDal.Get(p => p.CategoryId == category.Id);
         if (product != null)
         {
             return(new ErrorResult(Messagess.CategoryNotDeleted));
         }
         _categoryDal.Delete(category);
         return(new SuccesResult(Messagess.CategoryDeleted));
     }
     catch (Exception e)
     {
         return(new ErrorResult(e.Message));
     }
 }
示例#27
0
        public ResultMessage Delete(Category entity)
        {
            ResultMessage result = new ResultMessage();

            result.isSuccess = false;


            try
            {
                _categoryDal.Delete(entity);
                result.isSuccess = true;
            }
            catch (Exception e)
            {
                result.Message = "Bir Hata Oluştu";
                return(result);
            }
            return(result);
        }
        public ResultMesssage Delete(Category entity)
        {
            ResultMesssage result = new ResultMesssage();

            result.isSuccess = false;



            try
            {
                _categoryDal.Delete(entity);
                result.isSuccess = true;
                return(result);
            }
            catch (Exception e)
            {
                result.Message = string.Format("Bir Hata Oluştu {0}", e.Message);
                return(result);
            }
        }
示例#29
0
 public IResult DeleteCategory(Category category)
 {
     if (IsEndCategory(category.CategoryId))
     {
         try
         {
             if (!category.IsMainCategory)
             {
                 var subCategory = _subCategoryDal.Get(sc => sc.SubCategoryId == category.CategoryId);
                 _subCategoryDal.Delete(subCategory);
             }
             _categoryDal.Delete(category);
             return(new SuccessResult());
         }
         catch (Exception)
         {
             return(new ErrorResult(Messages.ErrorWhileDeletingEntity));
         }
     }
     return(new ErrorResult(Messages.CategoryCantDeleted));
 }
示例#30
0
        public DataResponse Delete(Category entity)
        {
            var category = _categoryDal.Delete(entity);

            if (category == null)
            {
                return new DataResponse
                       {
                           Mesaj      = "Aradiginiz Kategori Bulunamadi",
                           Tamamlandi = false
                       }
            }
            ;
            return(new DataResponse
            {
                Data = category,
                Mesaj = category.KategoriAdi + " Kategorisi Silindi",
                Tamamlandi = true
            });
        }
    }