Ejemplo n.º 1
0
 public ActionResult <IEnumerable <Categories> > GetCategories()
 {
     try
     {
         log.WriteLog("Category", MethodBase.GetCurrentMethod().Name, new { });
         var Categorys = repository.GetCategories();
         return(Ok(Categorys));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message));
     }
 }
Ejemplo n.º 2
0
        public ActionResult <IEnumerable <AuthorModel> > GetAuthors()
        {
            try
            {
                log.WriteLog("Author", MethodBase.GetCurrentMethod().Name, new { });
                List <AuthorModel> authors = (from author in repository.GetAuthors()
                                              select new AuthorModel
                {
                    BirthDay = author.BirthDay,
                    FirstName = author.FirstName,
                    ID = author.ID,
                    LastName = author.LastName
                }).ToList();

                return(Ok(authors));
            }
            catch (Exception ex)
            {
                return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message));
            }
        }