public CanResponse Can([FromBody] CanRequest canRequest) { try { _userService.Can(canRequest.Id, canRequest.Roles, canRequest.Claims, canRequest.CanAll); return(new CanResponse()); } catch (Exception ex) { return(new CanResponse { Success = false, Message = ex.Message }); } }
/// <summary> /// 设置能否执行申请操作 /// </summary> /// <param name="canRequest">能否执行申请操作</param> public void SetCanRequest(CanRequest canRequest) { switch (canRequest) { case CanRequest.可申请: CanRequest = CanRequest.可申请; break; case CanRequest.未报计划: CanRequest = CanRequest.未报计划; break; case CanRequest.已申请: CanRequest = CanRequest.已申请; IsValid = true; break; case CanRequest.可再次申请: CanRequest = CanRequest.可再次申请; break; case CanRequest.无需申请: CanRequest = CanRequest.无需申请; break; case CanRequest.已有发改委指标: CanRequest = CanRequest.已有发改委指标; break; default: throw new ArgumentOutOfRangeException("canRequest"); } }