예제 #1
0
        public IHttpActionResult GetProblemList()
        {
            if (!user_service.IsAuthorizedToViewAllProblemList())
            {
                return(Unauthorized());
            }

            var problems = problem_repository.GetAllProblemsList();

            return(Ok(ProblemListItem.MapTo(problems)));
        }
예제 #2
0
        public IHttpActionResult GetProblemList(int start, int limit)
        {
            var problems = problem_repository.GetProblems(start, limit);


            return(Ok(new CollectionResponse()
            {
                TotalCount = problem_repository.GetProblemCount(),
                Collection = ProblemListItem.MapTo(problems)
            }));
        }
예제 #3
0
        public IHttpActionResult GetUserProblems(int id, int start, int limit)
        {
            if (!user_service.IsAuthorizedToViewUserProblems(id))
            {
                return(Unauthorized());
            }

            var problems = user_repository.GetProblems(id, start, limit);


            return(Ok(new CollectionResponse()
            {
                TotalCount = user_repository.GetProblemCount(id),
                Collection = ProblemListItem.MapTo(problems)
            }));
        }