Exemplo n.º 1
0
 public async Task <UpdateUserRightsResponse> Post([FromBody] UserRightsAddRequest userRights)
 {
     if (_postUserRightsProcessor != null)
     {
         return(await _postUserRightsProcessor.PostNewUserRecord(userRights, _cloudantService));
     }
     else
     {
         return(new UpdateUserRightsResponse());
     }
 }
        public async Task <UpdateUserRightsResponse> PostNewUserRecord(UserRightsAddRequest userRightsAddRequest, ICloudantService cloudantService = null)
        {
            //AuditData auditData = new AuditData();
            //auditData.eventname = "Add";
            //auditData.loginid = loginuserAddRequest.loginid;
            //auditData.datetime = System.DateTime.UtcNow.ToString();
            //auditData.empid = employeeAddRequest.FormattedEmployeedId;

            if (cloudantService != null)
            {
                var response = await cloudantService.CreateAsync(userRightsAddRequest, DBNames.userrights.ToString());

                // var audit = await cloudantService.CreateAsync(auditData, DBNames.auditdata.ToString());
                return(JsonConvert.DeserializeObject <UpdateUserRightsResponse>(response));
            }
            else
            {
                return(new UpdateUserRightsResponse());
            }
        }