public IActionResult DeleteToDo(Guid id) { var userId = Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)); var toDosModel = _toDoService.DeleteToDo(id, userId); return(Ok(toDosModel)); }
public IActionResult Delete(int id) { try { var userName = this.User.Identity.Name; _toDoService.DeleteToDo(userName, id); return(Ok()); } catch (Exception) { return(Unauthorized()); } }
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)); } }
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)); } }
public ResponseMessage Delete(int id) { return(_service.DeleteToDo(new DeleteToDoRequest { Id = id })); }
public void Delete(int id) { _toDoService.DeleteToDo(id); }
public IActionResult DeleteToDo(int id) { _toDoService.DeleteToDo(id); return(NoContent()); }
public IActionResult Delete([FromBody] int toDoId) { return(Ok(_toDoService.DeleteToDo(toDoId, 1))); }