public object Delete(HelpJunction request) { switch (request.Junction.ToLower().TrimAndPruneSpaces()) { case "comment": return(RemoveJunction <Help, DocEntityHelp, DocEntityComment, Comment, CommentSearch>((int)request.Id, DocConstantModelName.COMMENT, "Comments", request)); case "favorite": return(RemoveJunction <Help, DocEntityHelp, DocEntityFavorite, Favorite, FavoriteSearch>((int)request.Id, DocConstantModelName.FAVORITE, "Favorites", request)); case "page": return(RemoveJunction <Help, DocEntityHelp, DocEntityPage, Page, PageSearch>((int)request.Id, DocConstantModelName.PAGE, "Pages", request)); case "scope": return(RemoveJunction <Help, DocEntityHelp, DocEntityScope, Scope, ScopeSearch>((int)request.Id, DocConstantModelName.SCOPE, "Scopes", request)); case "tag": return(RemoveJunction <Help, DocEntityHelp, DocEntityTag, Tag, TagSearch>((int)request.Id, DocConstantModelName.TAG, "Tags", request)); default: throw new HttpError(HttpStatusCode.NotFound, $"Route for help/{request.Id}/{request.Junction} was not found"); } }
public object Get(HelpJunction request) { switch (request.Junction.ToLower().TrimAndPruneSpaces()) { case "comment": return(GetJunctionSearchResult <Help, DocEntityHelp, DocEntityComment, Comment, CommentSearch>((int)request.Id, DocConstantModelName.COMMENT, "Comments", request, (ss) => HostContext.ResolveService <CommentService>(Request)?.Get(ss))); case "favorite": return(GetJunctionSearchResult <Help, DocEntityHelp, DocEntityFavorite, Favorite, FavoriteSearch>((int)request.Id, DocConstantModelName.FAVORITE, "Favorites", request, (ss) => HostContext.ResolveService <FavoriteService>(Request)?.Get(ss))); case "page": return(GetJunctionSearchResult <Help, DocEntityHelp, DocEntityPage, Page, PageSearch>((int)request.Id, DocConstantModelName.PAGE, "Pages", request, (ss) => HostContext.ResolveService <PageService>(Request)?.Get(ss))); case "scope": return(GetJunctionSearchResult <Help, DocEntityHelp, DocEntityScope, Scope, ScopeSearch>((int)request.Id, DocConstantModelName.SCOPE, "Scopes", request, (ss) => HostContext.ResolveService <ScopeService>(Request)?.Get(ss))); case "tag": return(GetJunctionSearchResult <Help, DocEntityHelp, DocEntityTag, Tag, TagSearch>((int)request.Id, DocConstantModelName.TAG, "Tags", request, (ss) => HostContext.ResolveService <TagService>(Request)?.Get(ss))); default: throw new HttpError(HttpStatusCode.NotFound, $"Route for help/{request.Id}/{request.Junction} was not found"); } }