예제 #1
0
        public async Task <ActionResult <Todo> > GetById(long id)
        {
            var todo = await _service.GetById(id);

            if (todo == null)
            {
                return(NotFound());
            }
            return(todo);
        }
예제 #2
0
 public ActionResult <Todo> GetById(string todosId)
 {
     try
     {
         return(Ok(_service.GetById(todosId)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
 public ActionResult <Todo> GetAll(int id)
 {
     try
     {
         return(Ok(_service.GetById(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }