public void Update(int id, CategoryCreateUpdateDto category) { var categoryToUpdate = todoListContext.Categories.FirstOrDefault(categoryEntity => categoryEntity.Id == id); mapper.Map(category, categoryToUpdate); todoListContext.SaveChanges(); }
public void Add(CategoryCreateUpdateDto category) { var result = mapper.Map <Category>(category); todoListContext.Add(result); todoListContext.SaveChanges(); }
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 IActionResult Update(Guid id, [FromBody] CategoryCreateUpdateDto categoryDto) { var result = _categoryService.Update(id, categoryDto); return(result.Success ? Ok(result.Message) : BadRequest(result.Message)); }
public IActionResult Update(int id, CategoryCreateUpdateDto category) { if (!categoryValidator.ValidateExistence(id) || !categoryValidator.ValidateInput(category)) { return(new BadRequestResult()); } categoryRepository.Update(id, category); return(new NoContentResult()); }
public IActionResult Add(CategoryCreateUpdateDto category) { if (!categoryValidator.ValidateInput(category)) { return(new BadRequestResult()); } categoryRepository.Add(category); return(new NoContentResult()); }
public IResult Update(Guid id, CategoryCreateUpdateDto categoryDto) { var categoryResult = GetById(id); if (!categoryResult.Success) { return(new ErrorResult(categoryResult.Message)); } var category = categoryResult.Data; category.Name = categoryDto.Name; return(_categoryDal.Update(category) ? new SuccessResult("Category updated.") : new ErrorResult("Category cannot updated!")); }
public IActionResult Put(int id, [FromBody] CategoryCreateUpdateDto category) { return(_categoryService.Update(id, category)); }
public IActionResult Post([FromBody] CategoryCreateUpdateDto category) { return(_categoryService.Add(category)); }
public bool ValidateInput(CategoryCreateUpdateDto note) { throw new NotImplementedException(); }
public Task <CategoryDto> UpdateAsync(Guid id, CategoryCreateUpdateDto input) { return(_service.UpdateAsync(id, input)); }
public Task <CategoryDto> CreateAsync(CategoryCreateUpdateDto input) { return(_service.CreateAsync(input)); }