示例#1
0
 public ActionResult Create(ListModel list)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (service.GetAllLists().All(e => e.Name != list.Name))
             {
                 service.AddList(list.ToServiceList());
                 if (Request.IsAjaxRequest())
                 {
                     var lim = Models.DataModels.List.GetListIndexModel();
                     return(PartialView("_ListCoverListView", lim));
                 }
                 return(RedirectToAction("Index"));
             }
         }
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         logger.Error(ex);
         return(View("Error"));
     }
 }
        public async Task Handle(GetAllListsCommand message, IMessageHandlerContext context)
        {
            var lists = await _listService.GetAllLists(message.UserId);

            await context.Reply(new GetResponse { Models = lists });
        }