public ActionResult <SkeletonSiteDto> GetSkeletonSiteByUrlMethod(string url) { try{ SkeletonSiteDto FoundSite = dbQuery.QuerySkeletonContentByUrl(url); return(FoundSite); }catch { return(StatusCode(404, "url not found")); } }
public ActionResult <JsonResponse> DeleteSite(int site_id, int admin_id, string admin_token) { if (authenticator.VerifyAdminForLeaf(admin_id, site_id, admin_token)) { SkeletonSiteDto found_site = dbQuery.QuerySkeletonSiteById(site_id); //must be done manually by the app to properly update the data limiter foreach (SiteComponentDto site_component in found_site.site_components) { ComponentReference component_reference = new ComponentReference() { component_id = site_component.component_id, component_type = site_component.type }; DeleteAuthenticatedSiteComponentMethod(component_reference); } //manually remove nav link data from data plan List <NavLink> found_nav_links; try{ found_nav_links = dbQuery.QueryNavBarLinksBySiteId(site_id); }catch { found_nav_links = null; } if (found_nav_links != null) { foreach (NavLink nav_link in found_nav_links) { _dataLimiter.RemoveNavLinkFromDataPlan(nav_link, admin_id); } } _dataLimiter.RemoveSiteFromDataPlan(admin_id); Site DeletedSite = dbQuery.DeleteSiteById(site_id); JsonResponse r = new JsonSuccess($"Site {DeletedSite.title} deleted sucessfully!"); return(r); } else { return(StatusCode(400, "Invalid Token. Stranger Danger.")); } }