예제 #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();
            }
        }
 public IActionResult GetList()
 {
     return(Ok(_role.GetList()));
 }