Beispiel #1
0
 public ActionResult GetOccupations()
 {
     ReferenceRepo referenceRepo = new ReferenceRepo();
     IEnumerable<Occupation> occupations = referenceRepo.GetOccupations();
     if (occupations != null && occupations.Any<Occupation>())
     {
         var value = from a in occupations
                     select new
                     {
                         Code = a.OccupationCd.Trim(),
                         Name = a.OccupationName
                     };
         return Json(new
         {
             OK = true,
             message = "Rekod wujud",
             list = JsonConvert.SerializeObject(value)
         });
     }
     return Json(new
     {
         OK = false,
         message = "Tiada Rekod"
     });
 }