Esempio n. 1
0
 public ActionResult <object> Select()
 {
     try
     {
         var test  = _seasonService.DoNothing();
         var items = _seasonService.GetAll();
         if (items.ToList().Count > 0)
         {
             var toSerialize = new MessageHelpers <SeasonViewModel>()
             {
                 Status = 200,
                 Data   = new List <SeasonViewModel>(items)
             };
             return(JsonConvert.SerializeObject(toSerialize));
         }
         else
         {
             var toSerialize = new MessageHelpers <SeasonViewModel>()
             {
                 Status = 404,
                 Data   = null
             };
             return(JsonConvert.SerializeObject(toSerialize));
         }
     }
     catch
     {
         var toSerialize = new MessageHelpers <SeasonViewModel>()
         {
             Status = 502,
             Data   = null
         };
         return(JsonConvert.SerializeObject(toSerialize));
     }
 }