public int AddFeedback(ICMTicket ticket, out string Error)
        {
            Validation v = new Validation(_dbContext);

            if (v.ValidateTicketNo(ticket.TicketID, out Error))
            {
                //if (v.ICMExistInDbOrNot(ticket.TicketID))
                //{
                //    Error = $"Feedback for {ticket.TicketID} Ticket Already given";
                //    return 0;
                //}

                var result = _dbContext.ICMTickets.Add(ticket);


                _dbContext.SaveChanges();
                if (result == null)
                {
                    Error = "There might be some issue while storing the data";
                    return(0);
                }
                Error = "Success";
                return(1);
            }
            return(0);
        }
        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));
        }