Example #1
0
 public ActionResult <string> DeleteTodos(string id)
 {
     try
     {
         return(Ok(_service.Delete(id)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
 public ActionResult <Todo> Delete(int id)
 {
     try
     {
         return(Ok(_service.Delete(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Example #3
0
        public async Task <ActionResult <string> > Delete(int id)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                _tdService.Delete(id, userInfo.Id);
                return(Ok("Deleted."));
            }
            catch (System.Exception err)
            {
                return(BadRequest(err.Message));
            }
        }
Example #4
0
        public async Task <ActionResult <Todo> > Delete(string id)
        {
            if (id == null || id == "")
            {
                return(BadRequest(new { message = "id is empty or null" }));
            }

            Todo todo = await todosService.GetTodoAsync(id);

            if (todo == null)
            {
                return(NotFound());
            }

            todosService.Delete(todo);

            return(Ok(new { message = "success" }));
        }