public IActionResult Add(WareHouse wareHouse) { string name = wareHouse.Name.ToString(); if (_wareHouseService.GetCountByName(name)) { return(View(wareHouse)); } else { _wareHouseService.Add(wareHouse); return(RedirectToAction("Index")); } }
public IActionResult Add(WareHouse wareHouse) { if (!_permissionService.Authorize("AddWareHouse")) { return(View("_AccessDeniedView")); } string name = wareHouse.Name.Trim(); string code = wareHouse.Code.Trim(); if (_wareHouseService.GetCountByName(name, code)) { return(Error("已有仓库名或仓库代码!")); } else { _wareHouseService.Add(wareHouse); return(Success()); } }