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