public async Task <IHttpActionResult> Put(SortSubCategoryCommand command) { var response = await Bus.Send <SortSubCategoryCommand, SortCategoryCommandResponse>(command); return(Ok(response)); }
public async Task <SortCategoryCommandResponse> Handle(SortSubCategoryCommand command) { var categoryRoot = await _repository.FindAsync(command.CaegoryRootId); if (categoryRoot == null) { throw new DomainException("دسته یافت نشد"); } foreach (var item in command.CategoryOrders) { var subCategory = categoryRoot.SubCategories.SingleOrDefault(p => p.Id == item.Id); if (subCategory == null) { throw new DomainException("زیر دسته بندی یافت نشد"); } subCategory.Order = item.Order; } return(new SortCategoryCommandResponse()); }