Example #1
0
        public HttpResponseMessage DeleteTelephone(string beforeTelephone)
        {
            try
            {
                int i = telephoneRepository.DeleteTelephone(beforeTelephone);

                if (i > 0)
                {
                    HttpResponseMessage hrm = new HttpResponseMessage(HttpStatusCode.NoContent)
                    {
                    };
                    return(hrm);
                }
                HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                };
                return(hr);
            }
            catch (Exception ex)
            {
                Errors errors          = ErrorsHelper.GetErrors(ex);
                HttpResponseMessage hr = new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(errors.ToString())
                };
                return(hr);
            }
        }
 public IActionResult DeleteTelephone(string beforeTelephone)
 {
     try
     {
         int i = telephoneRepository.DeleteTelephone(beforeTelephone);
         return(NoContent());
     }
     catch (Exception ex)
     {
         Errors errors = ErrorsHelper.GetErrors(ex);
         return(StatusCode(StatusCodes.Status500InternalServerError, errors));
     }
 }
Example #3
0
 public HttpResponseMessage DeleteTelephone(string beforeTelephone)
 {
     try
     {
         int i = telephoneRepository.DeleteTelephone(beforeTelephone);
         return(Request.CreateResponse(HttpStatusCode.NoContent));
     }
     catch (Exception ex)
     {
         Errors errors = ErrorsHelper.GetErrors(ex);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, errors));
     }
 }