Exemplo n.º 1
0
        public void PostComment(AccountDTO User, PortfolioDTO portfolio, string Comment)
        {
            PortfolioDTO original = portfolioAccess.Get(portfolio);

            if (!String.IsNullOrEmpty(User.NickName))
            {
                if (original != null)
                {
                    portfolio.Comments.Add($"{User.NickName} posted: {Comment}");
                    portfolioAccess.Update(original, portfolio);
                    return;
                }
            }
            throw new Exception("No nickname found");
        }
Exemplo n.º 2
0
        public void EditPortfolio(int index, PortfolioDTO Changes)
        {
            PortfolioDTO original = portfolioAccess.Read(index);
            PortfolioDTO Update   = new PortfolioDTO
                                    (
                original.Id,                                                                 //portfolio Id
                String.IsNullOrEmpty(Changes.Title) ? original.Title : Changes.Title,        //portfolio Title
                Changes.PageCategory == null ? original.PageCategory : Changes.PageCategory, //portfolio PageCategory list
                String.IsNullOrEmpty(Changes.Content) ? original.Content : Changes.Content,  //portfolio Content
                original.CreationDate,
                Changes.Comments == null ? original.Comments : Changes.Comments,
                Changes.EditDate == original.EditDate ? original.EditDate : DateTime.Today
                                    );

            //add current date to Changes in the edit section
            portfolioAccess.Update(portfolioAccess.Get(original), Update);
        }