예제 #1
0
        public ActionResult <IEnumerable <Todo> > Get(int limit, string search)
        {
            IEnumerable <Todo> todos = todosService.GetTodos();

            if (todos.Count() == 0)
            {
                return(NoContent());
            }

            if (search != null && search != "")
            {
                todos = todosService.Search(search, todos);
            }

            if (limit > 0)
            {
                todos = todos.TakeLast(limit);
            }

            return(Ok(new { todos }));
        }