public IActionResult AddFeedback(Ticket ticket) { string Error = ""; TryValidateModel(ticket); Ticket OldTicket = new Ticket() { TicketID = ticket.TicketID, TicketInfo = _dbContext.GetTicketInfo(ticket.TicketID) }; if (ModelState.IsValid) { ICMTicket _ticket = new ICMTicket() { TicketID = ticket.TicketID, ResponseTime = ticket.ResponseTime, Solution = ticket.Solution, Accuracy = ticket.Accuracy, SupportExperience = ticket.SupportExperience, Feedback = ticket.Feedback, }; if (_dbContext.AddFeedback(_ticket, out Error) > 0) { ModelState.AddModelError("Error", Error); string Message = ""; if (ticket.SupportExperience <= 5 && ticket.SupportExperience >= 3) { Message = "<img src='../images/satisfied.png'/><br/>" + "Thanks for your Positive Feedback. <br/> " + "We are happy to serve you better.<br/> " + "Your feedback encourage us to deliverer better"; } else if (ticket.SupportExperience < 3) { Message = " <img src='../images/dissatisfied.png' /> <br/> " + "Thanks for your valuable Feedback.<br/> " + "We are sorry, we already escalate the Ticket and will assign concern team to help you better."; ticket.TicketInfo = _dbContext.GetTicketInfo(_ticket.TicketID); _emailClient = new EmailForward(_config, _dbContext); _emailClient.SendICMEmail(ticket.TicketInfo); } TempData["Error"] = Message; return(RedirectToAction("Success")); } } ModelState.AddModelError("Error", Error); return(View(OldTicket)); }