コード例 #1
0
ファイル: TrialService.cs プロジェクト: crfroehlich/codegen
        public object Delete(TrialJunction request)
        {
            switch (request.Junction.ToLower().TrimAndPruneSpaces())
            {
            case "comment":
                return(RemoveJunction <Trial, DocEntityTrial, DocEntityComment, Comment, CommentSearch>((int)request.Id, DocConstantModelName.COMMENT, "Comments", request));

            case "document":
                return(RemoveJunction <Trial, DocEntityTrial, DocEntityDocument, Document, DocumentSearch>((int)request.Id, DocConstantModelName.DOCUMENT, "Documents", request));

            case "favorite":
                return(RemoveJunction <Trial, DocEntityTrial, DocEntityFavorite, Favorite, FavoriteSearch>((int)request.Id, DocConstantModelName.FAVORITE, "Favorites", request));

            case "tag":
                return(RemoveJunction <Trial, DocEntityTrial, DocEntityTag, Tag, TagSearch>((int)request.Id, DocConstantModelName.TAG, "Tags", request));

            default:
                throw new HttpError(HttpStatusCode.NotFound, $"Route for trial/{request.Id}/{request.Junction} was not found");
            }
        }
コード例 #2
0
ファイル: TrialService.cs プロジェクト: crfroehlich/codegen
        public object Get(TrialJunction request)
        {
            switch (request.Junction.ToLower().TrimAndPruneSpaces())
            {
            case "comment":
                return(GetJunctionSearchResult <Trial, DocEntityTrial, DocEntityComment, Comment, CommentSearch>((int)request.Id, DocConstantModelName.COMMENT, "Comments", request, (ss) => HostContext.ResolveService <CommentService>(Request)?.Get(ss)));

            case "document":
                return(GetJunctionSearchResult <Trial, DocEntityTrial, DocEntityDocument, Document, DocumentSearch>((int)request.Id, DocConstantModelName.DOCUMENT, "Documents", request, (ss) => HostContext.ResolveService <DocumentService>(Request)?.Get(ss)));

            case "favorite":
                return(GetJunctionSearchResult <Trial, DocEntityTrial, DocEntityFavorite, Favorite, FavoriteSearch>((int)request.Id, DocConstantModelName.FAVORITE, "Favorites", request, (ss) => HostContext.ResolveService <FavoriteService>(Request)?.Get(ss)));

            case "tag":
                return(GetJunctionSearchResult <Trial, DocEntityTrial, 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 trial/{request.Id}/{request.Junction} was not found");
            }
        }