Ejemplo n.º 1
0
        public IActionResult DeleteToDo(Guid id)
        {
            var userId     = Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier));
            var toDosModel = _toDoService.DeleteToDo(id, userId);

            return(Ok(toDosModel));
        }
Ejemplo n.º 2
0
 public IActionResult Delete(int id)
 {
     try
     {
         var userName = this.User.Identity.Name;
         _toDoService.DeleteToDo(userName, id);
         return(Ok());
     } catch (Exception)
     {
         return(Unauthorized());
     }
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> DeleteToDo(int id)
        {
            var changedToDo = await _toDoService.GetToDoById(id);

            if (changedToDo != null)
            {
                await _toDoService.DeleteToDo(id);

                return(Ok());   //200 + data
            }
            return(NotFound()); //400
        }
 public ActionResult Delete(int id, [FromQuery] int userId)
 {
     try
     {
         _toDoService.DeleteToDo(id, userId);
         Debug.WriteLine($"ToDo with {id} has been deleted");
         return(Ok($"Successfully deleted ToDo with id: {id}"));
     }
     catch (Exception ex)
     {
         Debug.WriteLine($"TODO: {id}{ex.Message}");
         return(BadRequest(ex.Message));
     }
 }
Ejemplo n.º 5
0
 public IActionResult Delete(int toDoId, int userId)
 {
     try
     {
         _toDoService.DeleteToDo(toDoId, userId);
         return(Ok("ToDo deleted"));
     }
     catch (CustomException ex)
     {
         return(BadRequest(ex.Message));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Ejemplo n.º 6
0
 public ResponseMessage Delete(int id)
 {
     return(_service.DeleteToDo(new DeleteToDoRequest {
         Id = id
     }));
 }
Ejemplo n.º 7
0
 public void Delete(int id)
 {
     _toDoService.DeleteToDo(id);
 }
Ejemplo n.º 8
0
 public IActionResult DeleteToDo(int id)
 {
     _toDoService.DeleteToDo(id);
     return(NoContent());
 }
 public IActionResult Delete([FromBody] int toDoId)
 {
     return(Ok(_toDoService.DeleteToDo(toDoId, 1)));
 }