Beispiel #1
0
 public ActionResult GetOrganizations()
 {
     try
     {
         var add   = new KeyContent(0, "Select an Organization");
         var items = CustomManager.GetOrganizations();
         if (items == null || !items.Any())
         {
             return(Json(new List <KeyContent> {
                 add
             }, JsonRequestBehavior.AllowGet));
         }
         var jsonitem = items.Select(o => new KeyContent(o.OrganizationId, o.Name)).ToList();
         jsonitem.Insert(0, add);
         return(Json(jsonitem, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         BugManager.LogApplicationBug(ex.StackTrace, ex.Source, ex.Message);
         return(Json(new List <KeyContent>(), JsonRequestBehavior.AllowGet));
     }
 }