Пример #1
0
        public async Task <HttpResponseMessage> UpdateUserPersonalData([FromBody] UserPersonalData model)
        {
            try
            {
                LogRequest(model);
                if (!ModelState.IsValid)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
                NeeoUser currentUser        = new NeeoUser(model.username);
                bool     operationCompleted = await System.Threading.Tasks.Task.Run(() => currentUser.UpdateUserPersonalData(model));

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            catch (ApplicationException applicationException)
            {
                return(Request.CreateErrorResponse((HttpStatusCode)Convert.ToInt16(applicationException.Message), NeeoDictionaries.HttpStatusCodeDescriptionMapper[Convert.ToInt16(applicationException.Message)]));
            }
            catch (Exception exception)
            {
                Logger.LogManager.CurrentInstance.ErrorLogger.LogError(System.Reflection.MethodBase.GetCurrentMethod().GetType(), exception.Message, exception);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }