Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }