コード例 #1
0
        public async Task <IHttpActionResult> Put(SortCategoryRootCommand command)
        {
            var response =
                await Bus.Send <SortCategoryRootCommand, SortCategoryRootCommandResponse>(command);

            return(Ok(response));
        }
コード例 #2
0
        public async Task <SortCategoryRootCommandResponse> Handle(SortCategoryRootCommand command)
        {
            foreach (var item in command.CategoryOrders)
            {
                var categoryRoot = await _repository.FindAsync(item.Id);

                if (categoryRoot == null)
                {
                    throw new DomainException("دسته یافت نشد");
                }
                categoryRoot.Order = item.Order;
            }
            return(new SortCategoryRootCommandResponse());
        }