Ejemplo n.º 1
0
        public async Task <HttpResponseMessage> CreateXMLChatBackup([FromBody] ChatBackupDTO chatBackupDTO)
        {
            NeeoUser neeoUser = new NeeoUser("0");

            try
            {
                if (!ModelState.IsValid)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
                bool operationCompleted = await System.Threading.Tasks.Task.Run(() => neeoUser.CreateXMLChatBackup(chatBackupDTO.sender, chatBackupDTO.messagesXml));

                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));
            }
        }