public async Task <StatusData <string> > UpsertSetting(UserSettingRequest request, int mode, SystemSession session)
        {
            List <string> distinctEntries = null;

            if (request.Entries != null)
            {
                distinctEntries = request.Entries.Distinct().ToList().ConvertAll(Convert.ToString);
            }
            var serviceRequest = new SettingPerson
            {
                UserId            = session.UserId.ToString(),
                SettingTypePerson = new SettingTypePerson
                {
                    SettingTypeId = (byte)request.SettingTypeId,
                    SettingGroup  = request.SettingGroupId
                },
                SettingValue = request.Value,
                Entries      = distinctEntries,
                Mode         = mode
            };

            var response = (await Task.Factory.StartNew(() => Client.SettingService.updateSetting(serviceRequest, session.GetSession())).ConfigureAwait(false)).GetStatusData <string>();

            return(response);
        }
        public async Task <APIResponseBase> SaveUserSetting(UserSettingRequest request)
        {
            APIResponseBase response = ValidateUserToken();

            if (response != null && response.ErrorCode == (int)LAMPConstants.API_SUCCESS_CODE)
            {
                response = await Task.Run(() => _userService.SaveUserSetting(request.UserSettingID, request));
            }
            return(response);
        }
Пример #3
0
 public Task <StatusData <string> > UpsertSetting(UserSettingRequest request, SystemSession session)
 {
     return(_jUnitOfWork.Setting.UpsertSetting(request, (int)SystemDbStatus.Flushed, session));
 }
        public async Task <HttpResponseMessage> Post([FromBody] UserSettingRequest request)
        {
            var response = await _service.UpsertSetting(request, Request.GetSession()).ConfigureAwait(false);

            return(Request.SystemResponse(response));
        }
Пример #5
0
 public async Task <SystemDbStatus> UpsertSetting(UserSettingRequest request)
 {
     return(await Task.Factory.StartNew(() => (SystemDbStatus)Context.PROC_UPSERT_CUSTOM_LIST(request.UserId, (byte)request.SettingTypeId, (int)SystemDbStatus.Updated, request.Value, string.Join(",", request.Entries.Distinct()), string.Empty).FirstOrDefault().GetValueOrDefault()).ConfigureAwait(false));
 }