public async Task <IResult> UpdateAsync(ColorUpdateDto colorUpdateDto) { var ruleResult = BusinessRules.Run(await CheckColorNameExistButIgnoreByIdAsync(colorUpdateDto.Id, colorUpdateDto.Name)); if (!ruleResult.Success) { return(ruleResult); } var findedColor = await _colorDal.GetAsync(p => p.Id == colorUpdateDto.Id); if (findedColor == null) { return(new ErrorResult(Messages.ColorNotFound)); } findedColor.Name = colorUpdateDto.Name; bool updateResult = await _colorDal.UpdateAsync(findedColor); if (!updateResult) { return(new ErrorResult(Messages.ColorNotUpdated)); } return(new SuccessResult(Messages.ColorUpdated)); }
public async Task <IResult> Update(Color color) { await _colorDal.UpdateAsync(color); return(new SuccessResult(Messages.ColorUpdated)); }
public async Task <IResult> UpdateAsync(Color entity) { await _colorDal.UpdateAsync(entity); return(new SuccessResult()); }