public void Delete(int id) { if (_articleRepositorio.Find(Convert.ToInt64(id)) != null) { _articleRepositorio.Delete(id); } else { var resp = new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.NotFound) { Content = new System.Net.Http.StringContent(string.Format("No product with ID = {0}", id)), ReasonPhrase = "Product Not Found" }; throw new Exception(resp.ReasonPhrase); } }
public Results DeleteAnArticle(int id) { try { results.Result = articles.Delete(id); results.Code = 0; results.ErrorMessage = string.Empty; } catch (Exception ex) { logger.LogError(ex.Message); results.Code = 1; results.ErrorMessage = ex.Message; } return(results); }