Ejemplo n.º 1
0
        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));
            }
        }
Ejemplo n.º 2
0
        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
                });
            }
        }