コード例 #1
0
        public override Request InsertRequest(RequestModel <RequestDelegatePermissionsUserModel> requestModel)
        {
            var delegationRequestUsersExtInfo = new List <DelegationRequestUsersExtInfo>();
            var request = ConvertToRequest(requestModel, (rua, user) =>
            {
                delegationRequestUsersExtInfo.Add(GetDelegationRequestUsersExtInfo(rua, user));
            });

            request.User = RequestSecurityService.GetUserInfo();
            var idRequestStateType =
                RequestSecurityService.CanSetRequestStateGlobal(request, 1) ? 1 : 2;

            request.RequestStates = new List <RequestState>
            {
                new RequestState
                {
                    IdRequestStateType = idRequestStateType,
                    Request            = request,
                    Date = DateTime.Now
                }
            };
            var insertedRequest = RequestsRepository.InsertRequest(request);

            RequestsRepository.InsertDelegationRequestUsersExtInfo(delegationRequestUsersExtInfo);
            return(insertedRequest);
        }