コード例 #1
0
        public ActionResult Save()
        {
            var saveState = BusinessHelper.BuildSaveState(Request);

            if (saveState == null)
            {
                throw new ArgumentNullException(nameof(saveState));
            }

            switch (saveState.OperationState)
            {
            case OperationState.Add:
            case OperationState.Update:

                var userDto  = _userBll.HttpGetSave(saveState);
                var roleList = _roleBll.GetList();

                ViewBag.RoleList  = roleList;
                ViewBag.SaveState = saveState.ToJson();

                return(View(userDto));

            case OperationState.Remove:
                //逻辑删除
                _userBll.HttpGetSave(saveState);

                return(RedirectToAction("Index", "User"));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #2
0
 public IActionResult GetList()
 {
     return(Ok(_role.GetList()));
 }