public bool DeletePostIt(int postItId) { PostIt postIt = _postIts.SingleOrDefault(p => p.Id == postItId); if (postIt == null) { throw new ArgumentException("PostIt not found"); } return(_postIts.Remove(postIt)); }
public void AddPostIt(PostIt postIt) { int id = 1; if (_postIts.Count() != 0) { id = _postIts.Select(p => p.Id).Max() + 1; } postIt.Id = id; _postIts.Add(postIt); }
public bool AddPostIt(int id, PostIt postIt) { bool isAdded = false; var board = Find(id); if (board != null) { board.PostIts.Add(postIt); isAdded = true; } return(isAdded); }
public PostIt AddPostIt(int boardId, string text) { if (String.IsNullOrWhiteSpace(text)) { throw new ArgumentException("PostIt text can not be null, empty or whitespace"); } Board board = Find(boardId); if (board == null) { throw new ArgumentException("Board not found"); } PostIt postIt = new PostIt { Text = text, CreatedAt = DateTime.Now }; board.AddPostIt(postIt); return(postIt); }