public JsonResult GetPublicApps(string id)
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             return(Json(new { Status = (int)HttpStatusCode.InternalServerError }));
         }
         else
         {
             List <Applications> applications = AddonAPI.GetAppInfo(id);
             if (applications != null && applications.Count > 0)
             {
                 return(Json(new { Status = (int)HttpStatusCode.OK, apps = applications }));
             }
             else
             {
                 return(Json(new { Status = (int)HttpStatusCode.NoContent }));
             }
         }
     }
     catch (Exception ex)
     {
         return(Json(new { Status = (int)HttpStatusCode.InternalServerError }));
     }
 }
 public JsonResult GetAppDetail(string id)
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             return(Json(new { Status = (int)HttpStatusCode.InternalServerError }));
         }
         else
         {
             Applications app = AddonAPI.GetAppDetail(id);
             if (app != null)
             {
                 return(Json(new { Status = (int)HttpStatusCode.OK, apps = app }));
             }
             else
             {
                 return(Json(new { Status = (int)HttpStatusCode.NoContent }));
             }
         }
     }
     catch (Exception ex)
     {
         return(Json(new { Status = (int)HttpStatusCode.InternalServerError }));
     }
 }
 public IActionResult Index(string id)
 {
     try
     {
         string resourceId = ConfigVars.Instance.ResourceId;
         Console.WriteLine("resource id :" + id);
         if (!string.IsNullOrEmpty(resourceId))
         {
             Resources resource = AddonAPI.GetResource(resourceId);
             Console.WriteLine("resource  :" + JsonConvert.SerializeObject(resource));
             if (resource != null && !string.IsNullOrEmpty(resource.uuid))
             {
                 List <Categories> result = AddonAPI.GetCategoryInfo(resourceId);
                 Console.WriteLine("Categories :" + JsonConvert.SerializeObject(result));
                 if (result != null && result.Count > 0)
                 {
                     ViewBag.Categories   = result;
                     ViewBag.AlertMessage = null;
                 }
             }
             else
             {
                 ViewBag.Categories   = null;
                 ViewBag.AlertMessage = "Portfolio Manager is De-provisioned from your Heroku account. Please delete this App from your account as it will not work when it is not linked to a Portfolio Manager add-on.";
             }
             return(View());
         }
         else
         {
             ViewBag.Categories   = null;
             ViewBag.AlertMessage = "Portfolio Manager is De-provisioned from your Heroku account. Please delete this App from your account as it will not work when it is not linked to a Portfolio Manager add-on.";
             return(View());
         }
     }
     catch (Exception ex)
     {
         ViewBag.Categories   = null;
         ViewBag.AlertMessage = null;
         _logger.LogError(ex.Message, ex);
     }
     return(View());
 }