public IResult AddCategory(Category category, int mainCategoryId = -1) { if (mainCategoryId == -1) { try { _categoryDal.Add(category); return(new SuccessResult()); } catch (Exception) { return(new ErrorResult(Messages.ErrorWhileAddingEntity)); } } try { _categoryDal.Add(category); var addedCategory = _categoryDal.Get(c => c.CategoryName == category.CategoryName); var subCategory = new SubCategory { CategoryId = mainCategoryId, SubCategoryId = addedCategory.CategoryId }; _subCategoryDal.Add(subCategory); return(new SuccessResult()); } catch (Exception e) { return(new ErrorResult(Messages.ErrorWhileAddingEntity)); } }
public void Add(Category category) { if (category == null || String.IsNullOrEmpty(category.Name) || String.IsNullOrEmpty(category.Description)) { return; } _categoryDal.Add(category); }
public IResult Add(Category category) { //İş Kuralları //... _categoryDal.Add(category); return(new SuccessResult(Messages.CategoryAdded)); }
public IResult Add(Category category) { //ValidationTool.Validate(new CategoryValidator(), category); _categoryDal.Add(category); return(new SuccessDataResult <Category>(Messages.DataAdded)); }
public IResult Add(Category category) { _validation = new Validation <CategoryValidator>(); _validation.Validate(category); _categoryDal.Add(category); return(new SuccessResult()); }
public ResultMessage Add(Category entity) { ResultMessage result = new ResultMessage(); result.IsSuccess = false; if (entity.Name.Length == 0) { result.Message = "Kategori Adı Belirtmelisiniz"; return(result); } if (entity.Name.Length > 50) { result.Message = "Kategori Adı daha kısa olmalıdır"; return(result); } try { _categoryDal.Add(entity); result.IsSuccess = true; } catch (Exception e) { result.Message = string.Format("Bir hata oluştu: {0}", e.Message); return(result); } return(result); }
public ResultMessage Add(Category entity) { ResultMessage result = new ResultMessage(); result.isSuccess = false; if (entity.Name.Length == 0) { result.Message = "Kategori Adı Belirtmelisiniz"; return(result); } if (entity.Name.Length == 50) { result.Message = "Kategori Adı için fazla karakter girdiniz."; return(result); } try { _categoryDal.Add(entity); result.isSuccess = true; } catch (Exception e) { result.Message = "Bir Hata Oluştu"; return(result); } return(result); }
public IResult Add(Category category) { category.CreateDate = DateTime.Now; category.Active = true; _categoryDal.Add(category); return(new SuccessResult(BusinessMessages.CategoryAdded)); }
public IResult Add(CategoryCreateUpdateDto categoryDto) { var category = _mapper.Map <Category>(categoryDto); return(_categoryDal.Add(category) ? new SuccessResult("Category created.") : new ErrorResult("Category cannot created!")); }
public void Add(Category category) { ValidationTool.Load(new CategoryRules(), category); _categoryDal.Add(category); }
public IResult Add(Category category) { ValidationTool.Validate(new CategoryValidator(), category); _categoryDal.Add(category); return(new SuccessResult(Messages.CategoryAdded)); }
public IResult Add(Category category) { if (category.CategoryName.Length < 3) { return(new ErrorResult(Messages.NameInvalid)); } _categoryDal.Add(category); return(new SuccessResult()); }
public void Add(Category category) { if (category.CategoryName.Length < 2) { throw new Exception("Kategori ismi min 2 karakter olmalıdır"); } _categoryDal.Add(category); }
public IActionResult Create(Category category) { if (ModelState.IsValid) { _categoryDal.Add(category); return(RedirectToAction("Index", "Categories")); } return(View(category)); }
public void Add(CategoryDto data) { var category = new Category { Name = data.Name, Description = data.Description }; _categoryDal.Add(category); }
public IResult Add(Category category) { if (category.CategoryName.Length > 5) { return(new ErrorResult("Kategori adı en az 5 karakter olmalıdır")); } _categoryDal.Add(category); return(new SuccessResult(Messages.CategoryAdded)); }
public bool Add(Category category) { if (string.IsNullOrEmpty(category.CategoryName)) { return(false); } categoryDal.Add(category); return(true); }
//[SecuredOperation("admin,moderator")] public IResult GetCategoryAdd(Category category) { var result = BusinessRules.Run(CheckCategoryNameExists(category.CategoryName)); if (result != null) { return(result); } _categoryDal.Add(category); return(new SuccessResult(Messages.CategoryAdded)); }
public IResult Add(Category category) { var result = BusinessRules.Run(ExampleBusinessRule()); if (result != null) { return(result); } _categoryDal.Add(category); return(new SuccessResult(Messages.CategoryAdded)); }
public bool Add(Category category) { bool result = _categoryDal.Add(category); if (result) { return(true); } return(false); }
public Category Add(Category category, HttpPostedFileBase Image) { if (Image != null) { ImageDetail imagePath = _fileUploadService.ThumbImageSave(Image, "Category", 225, 225); category.Image = imagePath.Image; category.ThumbImage = imagePath.ThumbImage; } return(_categoryDal.Add(category)); }
public void AddCategory(Category category) { if (category != null) { _categoryDal.Add(category); } else { throw new Exception("Hata oldu"); } }
public IDataResult <Category> Add(Category category) { if (category != null) { return(new SuccessDataResult <Category>(_categoryDal.Add(category), "Category added!")); } else { return(new ErrorDataResult <Category>(category, "Category could not be added!")); } }
public IResult Add(Category category) { var result = _categoryDal.Get(c => c.CategoryName == category.CategoryName); if (result == null) { _categoryDal.Add(category); return(new SuccessResult(Messages.Categories.Add(category.CategoryName))); } return(new ErrorResult(Messages.Categories.Exists(category.CategoryName))); }
public IResult Add(Category category) { if (category.CategoryName.Length > 2) { _categoryDal.Add(category); return new SuccessResult(Messages.CategoryAdded); } else { return new ErrorResult(Messages.CategoryNameInvalid); } }
public IResult Add(Category category) { IResult result = BusinessRules.Run(CheckIfCategoryNameExists(category.CategoryName)); if (result != null) { return(new ErrorResult()); } _categoryDal.Add(category); return(new SuccessResult(Messages.Categories.Add(category.CategoryName))); }
public IResult Add(Category entity) { try { _categoryDal.Add(entity); return(new SuccessResult("Category eklendi")); } catch (Exception ex) { return(new ErrorResult(ex.ToString())); } }
public IResult Add(Category category) { try { _categoryDal.Add(category); return(new SuccessResult(Messages.SuccessAdded)); } catch (Exception) { return(new ErrorResult(Messages.ErrorAdded)); } }
public IResult Add(Category category) { IResult result = BusinessRules.Run(CheckIfCategoryNameExists(category.CategoryName)); if (!(result is null)) { return(result); } _categoryDal.Add(category); return(new SuccessResult(Messages.CategoryAdded)); }
public Category Insert(CategoryDto categoryDto) { if (!IsCategoryCheck(categoryDto.Title)) { var category = new Category() { Description = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(categoryDto.Description), Title = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(categoryDto.Title) }; return(_categoryDal.Add(category)); } throw new Exception("Girdiğiniz Kategori bilgilerini kontrol ediniz"); }