public HttpResponseMessage UpdateMessage([FromUri] int id, [FromBody] string message) { try { if (_messengerRepository.IsIdExist(id)) { _messengerRepository.UpdateMessage(id, message); return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(CreateMessageNotFoundResponse(id)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex)); } }
public ServerResponse UpdateMessage(int id, string message) { try { _messengerService.UpdateMessage(id, message); return(new ServerResponse { Success = true }); } catch (Exception ex) { return(new ServerResponse { Success = false, ErrorDetails = ex.Message }); } }