Пример #1
0
 /// <summary>
 /// 创建清单
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="inventoryName"></param>
 /// <returns></returns>
 public IActionResult CreateInventory(string inventoryName)
 {
     if (inventoryName != null)
     {
         var result = _inventoryService.CreateInventory(UserController._userView.Id, inventoryName);
         if (result)
         {
             var inventoryList = _inventoryService.ViewAllInventory(UserController._userView.Id);
             var viewInventory = SaveInViewModels(inventoryList);
             return(View("ViewAfterCreateInventory", viewInventory));
         }
         else
         {
             var inventoryList = _inventoryService.ViewAllInventory(UserController._userView.Id);
             var viewInventory = SaveInViewModels(inventoryList);
             return(View("ViewInventoryNameRepeat", viewInventory));
         }
     }
     else
     {
         var inventoryList = _inventoryService.ViewAllInventory(UserController._userView.Id);
         var viewInventory = SaveInViewModels(inventoryList);
         return(View("ViewAfterCreateInventory", viewInventory));
     }
 }