public int DeleteList(DeleteListDto deleteListDto) { using (var db = new PGSBoardContext()) { var listToRemove = db.Lists.Single(list => list.Id == deleteListDto.ListId); db.Lists.Remove((listToRemove)); return(db.SaveChanges() == 1 ? deleteListDto.ListId : 0); } }
public IActionResult DeleteList([FromBody] DeleteListDto deleteListDto) { var userId = User.GetUserId(); var deletedList = _listService.DeleteList(deleteListDto, userId); if (deletedList == null) { return(NotFound()); } return(Ok(deletedList.Id)); }
public bool DeleteList(DeleteListDto deleteListDto) { var list = _context.Lists.SingleOrDefault(l => l.Id == deleteListDto.ListId); if (list == null) { return(false); } _context.Lists.Remove(list); _context.SaveChanges(); return(true); }
public JsonResult DeleteList(int listId) { var deleteListDto = new DeleteListDto() { ListId = listId }; var result = _boardsService.DeleteList(deleteListDto); return(new JsonResult() { Data = result }); }
public IActionResult DeleteListName(DeleteListDto deleteListDto) { if (!ModelState.IsValid) { return(BadRequest()); } bool deleteSuccessful = _listService.DeleteList(deleteListDto); if (!deleteSuccessful) { return(BadRequest()); } return(NoContent()); }
public IActionResult DeleteList([FromBody] DeleteListDto deleteListDto) { if (!ModelState.IsValid) { return(BadRequest()); } var result = _listService.DeleteList(deleteListDto); if (!result) { return(BadRequest()); } return(NoContent()); }
public bool DeleteList(DeleteListDto deleteListDto) { if (!_context.Boards.Any(x => x.Id == deleteListDto.BoardId)) { return(false); } var list = _context.Lists.SingleOrDefault(l => l.Id == deleteListDto.ListId); if (list == null) { return(false); } _context.Remove(list); var result = _context.SaveChanges(); return(result > 0); }
public IActionResult DeleteList(int id, int boardId) { var deleteListDto = new DeleteListDto { BoardId = boardId, ListId = id }; if (deleteListDto.ListId <= 0 && deleteListDto.ListId <= 0) { return(BadRequest()); } var result = _listService.DeleteList(deleteListDto); if (!result) { return(BadRequest()); } return(NoContent()); }
public ListDto DeleteList(DeleteListDto deleteListDto, string userId) { if (!_listRepository.IsOwner(deleteListDto.ListId, userId)) { return(null); } var list = _listRepository.GetList(deleteListDto.ListId); if (list == null) { return(null); } var deletedList = _listRepository.DeleteList(list); var listsWithPositionToUpdate = GetCardsWithPositionToDecrease(deletedList.BoardId, deletedList.Position); _listRepository.UpdateListsPosition(listsWithPositionToUpdate); var result = _mapper.Map <ListDto>(deletedList); return(result); }
public int DeleteList(DeleteListDto deleteListDto) { return(this.boardsRepository.DeleteList(deleteListDto)); }