public void Delete(int categoryId) { //_categoryDal.Delete(this.GetById(categoryId)); _categoryDal.Delete(new Category { CategoryId = categoryId }); }
public IResult Remove(int categoryId) { Category toRemove = GetById(categoryId).Data; _categoryDal.Delete(toRemove); return(new SuccessResult(Messages.CategoryRemoved)); }
public IResult Delete(Category category) { Category result = _categoryDal.Get(c => c.CategoryId == category.CategoryId); _categoryDal.Delete(result); return(new SuccessResult(Messages.CategoryDeleted)); }
public int DeleteCategory(int Id) { _categoryDal.Delete(new Category { Id = Id }); return(Id); }
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))); }
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); }
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ı!")); }
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)); }
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!")); } }
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)); }
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"); } }
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)); }
public IActionResult Delete(int?id) { if (id == null) { return(BadRequest()); } var category = _categoryDal.Get(x => x.Id == id); _categoryDal.Delete(category); return(Json(category)); }
public IResult Delete(Category category) { try { _categoryDal.Delete(category); } catch (Exception exception) { return(new ErrorResult(exception.Message)); } return(new SuccessResult(Messages.CategoryDeleted)); }
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())); } }
public void DeleteCategory(int id) { if (id > 1) { _categoryDal.Delete(new Category { CategoryID = id }); } else { throw new Exception("Hata oldu"); } }
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); } }
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); }
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); } }
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)); } }
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)); } }
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); } }
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)); }
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 }); } }