public Task <UpdateCategoryRootCommandResponse> Handle(UpdateCategoryRootCommand command) { _categoryDomainService.CheckCategoryName(command.Id, command.Name); var categoryRoot = _repository.AsQuery().SingleOrDefault(p => p.Id == command.Id); if (categoryRoot == null) { throw new DomainException("دسته یافت نشد"); } categoryRoot.Name = command.Name; categoryRoot.Description = command.Description; categoryRoot.CategoryImage = new CategoryImage(command.CategoryImage.MainCatImage, command.CategoryImage.FullMainCatImage, command.CategoryImage.TopPageCatImage); return(Task.FromResult(new UpdateCategoryRootCommandResponse())); }
/// <summary> /// ویرایش یک دسته اصلی /// </summary> /// <param name="command"></param> /// <returns></returns> public async Task <IHttpActionResult> Put(UpdateCategoryRootCommand command) { var response = await Bus.Send <UpdateCategoryRootCommand, UpdateCategoryRootCommandResponse>(command); return(Ok(response)); }