Ejemplo n.º 1
0
        public int EditTicketCommentById(int id, HelpDesk_TicketComments_vm comment)
        {
            if (id == 0)
            {
                throw new ArgumentOutOfRangeException("Id cannot be 0.");
            }

            return(_helpDeskTicketCommentRepository.EditTicketCommentById(id,
                                                                          mapViewModelToEntityTicketComments(comment)));
        }
Ejemplo n.º 2
0
        public int CreateTicketComment(int ticketId, HelpDesk_TicketComments_vm comment)
        {
            if (ticketId == 0)
            {
                throw new ArgumentOutOfRangeException("TicketId cannot be 0.");
            }

            return(_helpDeskTicketCommentRepository.CreateTicketComment(ticketId,
                                                                        mapViewModelToEntityTicketComments(comment)));
        }
Ejemplo n.º 3
0
        private HelpDesk_TicketComments mapViewModelToEntityTicketComments(HelpDesk_TicketComments_vm VMTicketComment)
        {
            ServiceDesk_Users assignedTo    = _nsUserRepository.GetUserByUserName(VMTicketComment.AuthorUserName);
            HelpDesk_Tickets  relatedTicket = _helpDeskTicketRepository.GetTicketByID(VMTicketComment.TicketID);

            return(new HelpDesk_TicketComments
            {
                Id = VMTicketComment.Id,
                Author = assignedTo.Id,
                Comment = VMTicketComment.Comment,
                CommentDateTime = DateTime.UtcNow,
                CommentTypeID = VMTicketComment.CommentTypeID,
                TicketID = relatedTicket.Id
            });
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Puts the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public int Put(int id, [FromBody] HelpDesk_TicketComments_vm value)
 {
     _logger.Info("Editing the comment with id " + id);
     return(_helpDeskTicketCommentManager.EditTicketCommentById(id, value));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Posts the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="value">The value.</param>
 /// <returns></returns>
 public int Post(int id, [FromBody] HelpDesk_TicketComments_vm value)
 {
     _logger.Info("Adding a new comment for ticket with id " + id);
     return(_helpDeskTicketCommentManager.CreateTicketComment(id, value));
 }