public void UpdateTicketContactHistoryManualTest() { ticketRepository.DetachGet = true; var result = ticketRepository.GetLast(); Assert.AreEqual(result.OK, true); ticketRepository.DetachGet = false; result.Ticket.UpdatedAt = DateTime.Now; result.Ticket.UpdatedBy = new User(Id: "testuser"); var comment = "Comment #" + new Random().Next(); ResponseHistory rh; if (result.Ticket.ResponseHistory != null && result.Ticket.ResponseHistory.Count > 0) { rh = result.Ticket.ResponseHistory.Last(); } else { if (result.Ticket.ResponseHistory == null) { result.Ticket.ResponseHistory = new List <ResponseHistory>(); } rh = new ResponseHistory(); result.Ticket.ResponseHistory.Add(rh); } rh.Comment = comment; rh.ResponseBy = result.Ticket.UpdatedBy; var result2 = ticketRepository.Update(result.Ticket); Assert.AreEqual(result2.OK, true); }
// ------------------------------------------------------------------- public static tblContactHistory ToContactHistory(ResponseHistory ResponseHistory, Ticket Ticket) { return(new tblContactHistory { FileNum = Ticket.Id, Id = ResponseHistory.Id, UserId = ResponseHistory.ResponseBy.Id != null?ResponseHistory.ResponseBy.Id.TrimEnd() : null, ContactDateTime = ResponseHistory.ResponseAt, Via = ResponseHistory.Via.ToString(), Comment = ResponseHistory.Comment }); }