Exemplo n.º 1
0
        public void Update(string title = null, string content = null, string imageUrl = null)
        {
            // TODO: Edit how the update system is used.
            if (IsClosed)
            {
                throw new Exception("The report specified has already been closed.");
            }

            bool edited = false;
            var  old    = new ReportBody(Title, Content, ImageUrl);

            if (Check.NotNull(title))
            {
                Title  = title;
                edited = true;
            }

            if (Check.NotNull(content))
            {
                Content = content;
                edited  = true;
            }

            if (Check.NotNull(imageUrl))
            {
                ImageUrl = imageUrl;
                edited   = true;
            }

            if (edited)
            {
                EditedAt = DateTime.UtcNow;
                LastInfo = old;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Opens a new report.
        /// </summary>
        public int Open(IUser user, OverloadNode overload, ReportBody info, ReportTag tag)
        {
            Reports.Add(new Report(CaseCount, overload, user, info, tag));
            int id = CaseCount;

            CaseCount++;
            return(id);
        }
Exemplo n.º 3
0
 internal Report(int id, OverloadNode overload, IUser user, ReportBody reportInfo, ReportTag tag)
 {
     Id        = id;
     CommandId = overload.Id;
     Author    = new Author(user);
     CreatedAt = DateTime.UtcNow;
     Title     = reportInfo.Title;
     Content   = reportInfo.Content;
     ImageUrl  = reportInfo.ImageUrl;
     Tag       = tag;
     State     = ReportState.Open;
     Votes     = new List <VoteInfo>();
 }
Exemplo n.º 4
0
 internal Report(int id, string commandId, Author author, DateTime createdAt,
                 DateTime?editedAt, string title, string content, string imageUrl, ReportBody lastInfo, ReportState status,
                 List <VoteInfo> votes, ReportTag tag)
 {
     Id        = id;
     CommandId = commandId;
     Author    = author;
     CreatedAt = createdAt;
     EditedAt  = editedAt;
     Title     = title;
     Content   = content;
     ImageUrl  = imageUrl;
     LastInfo  = lastInfo;
     Tag       = tag;
     State     = status;
     Votes     = votes ?? new List <VoteInfo>();
 }