public IHttpActionResult Put(ChatMessageUpdateRequest model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState)); // validation check on model
                }
                _chatMessageService.Update(model);  // on is valid and success, set Item to hold response id
                return(Ok(new SuccessResponse()));
            }
            catch (Exception ex)
            {
                int currentUser = _userService.GetCurrentUserId();
                _appLogService.Insert(new AppLogAddRequest
                {
                    AppLogTypeId = 1,
                    Message      = ex.Message,
                    StackTrace   = ex.StackTrace,
                    Title        = "Error in " + GetType().Name + " " + System.Reflection.MethodBase.GetCurrentMethod().Name,
                    UserBaseId   = currentUser
                });

                return(BadRequest(ex.Message));
            }
        }
Пример #2
0
 public HttpResponseMessage Put(ChatMessageUpdateRequest model)
 {
     try
     {
         model.UserBaseId = _userService.GetCurrentUserId();
         _chatMessageService.Update(model);
         return(Request.CreateResponse(HttpStatusCode.OK, new SuccessResponse()));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }