// GET: api/articles public IHttpActionResult Get() { dynamic Response = new System.Dynamic.ExpandoObject(); var json = string.Empty; try { IList <Articles> articles = new ArticlesBL().getArticles(); if (articles.Count > 0) { Response.success = true; Response.articles = new List <Articles>(); Response.articles = articles; Response.total_elements = articles.Count; } else { Response.success = false; Response.error_code = HttpStatusCode.NotFound; Response.error_msg = "Records not Found"; } json = new JavaScriptSerializer().Serialize(Response); return(Ok(json)); } catch (System.Exception ex) { Response.success = false; Response.error_code = HttpStatusCode.InternalServerError; Response.error_msg = ex.Message.ToString(); json = new JavaScriptSerializer().Serialize(Response); return(Ok(json)); } }
// DELETE: api/articles/5 public Result <bool> Delete(int id) { _bl = new ArticlesBL(); return(_bl.Delete(id)); }
// PUT: api/articles/5 public Result <ArticleDto> Put(int id, [FromBody] ArticleDto value) { _bl = new ArticlesBL(); return(_bl.Update(value)); }
// POST: api/articles public Result <ArticleDto> Post([FromBody] ArticleDto value) { _bl = new ArticlesBL(); return(_bl.Add(value)); }
public Result <ComplexArticles <List <ArticleDto> > > GetByStore(int id) { _bl = new ArticlesBL(); return(_bl.GetByStore(id)); }
// GET: api/articles/5 public Result <ComplexArticles <ArticleDto> > Get(int id) { _bl = new ArticlesBL(); return(_bl.Get(id)); }
// GET: api/articles public Result <ComplexArticles <List <ArticleDto> > > Get() { _bl = new ArticlesBL(); return(_bl.Get()); }