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))); }
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))); }
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 }); }
/// <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)); }
/// <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)); }