示例#1
0
        public IActionResult ManageBacklog(ManageBacklogViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                return(View(vm));
            }

            var request   = vm.ToRequest(CurrentUserId);
            var presenter = _presenterFactory.ManageBacklog(MessageHandler, ErrorHandler);

            try
            {
                var uc       = _useCaseFactory.ManageBacklog;
                var response = uc.Execute(request);
                return(RedirectToAction(nameof(Backlog), new { id = presenter.Present(response), flavor = "Backlog" }));
            }
            catch (InvalidRequestException ire)
            {
                presenter.PresentErrors(ire.Message, ire.Errors);
                return(View(vm));
            }
            catch (Exception e)
            {
                presenter.PresentMessage(MessageType.Error, e.Message);
                return(View(vm));
            }
        }
示例#2
0
 public static ManageBacklogRequest ToRequest(this ManageBacklogViewModel vm, string userId)
 {
     return(new ManageBacklogRequest(userId)
     {
         ProjectId = Identity.FromString(vm.Project.Id),
         BacklogItems = vm.Ids.Select((x, i) => new ManageBacklogRequest.BacklogItem
         {
             Id = Identity.FromString(x),
             Status = Enum.Parse <ProductBacklog.WorkTaskStatus>(vm.Status[i])
         }).ToList(),
     });
 }