Exemple #1
0
        public static TicketCommentDeleteViewModel CreateNewViewModel(Domain.TicketComment ticketComment)
        {
            if (ticketComment == null)
            {
                throw new ArgumentNullException(nameof(ticketComment));
            }

            return(new TicketCommentDeleteViewModel()
            {
                Id = ticketComment.Id,
                Comment = ticketComment.Comment,
                TicketId = ticketComment?.Ticket.Id ?? throw new ArgumentException("TicketComment wasn't attached to ticket"),
                TicketTitle = ticketComment?.Ticket.Title ?? throw new ArgumentException("TicketComment wasn't attached to ticket"),
            });
Exemple #2
0
        public static TicketCommentEditViewModel CreateNewViewModel(Domain.TicketComment ticketComment)
        {
            if (ticketComment == null)
            {
                throw new ArgumentNullException();
            }

            return(new TicketCommentEditViewModel()
            {
                Id = ticketComment.Id,
                Comment = ticketComment.Comment,
                TicketId = ticketComment.TicketId,
                TicketTitle = ticketComment.Ticket.Title,
                UserId = ticketComment.UserId,
            });
        }
        public static TicketCommentIndexViewModel CreateNewViewModel(Domain.TicketComment ticketComment)
        {
            if (ticketComment == null)
            {
                throw new ArgumentNullException(nameof(ticketComment));
            }

            return(new TicketCommentIndexViewModel()
            {
                Id = ticketComment.Id,
                Comment = ticketComment.Comment,
                DateCreated = ticketComment.DateCreated,
                TicketId = ticketComment.TicketId,
                UserId = ticketComment.UserId,
                UserEmail = ticketComment.User.Email,
            });
        }