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));
        }
Ejemplo n.º 2
0
        public void CreateEmailForwardClientValidation(string from, string to)
        {
            var client = new MockDnsimpleClient(CreateEmailForwardFixture);
            var record = new EmailForward
            {
                From = from,
                To   = to
            };

            Assert.Throws(Is.InstanceOf <Exception>(),
                          delegate
            {
                client.Domains.CreateEmailForward(1010, "ruby.codes",
                                                  record);
            });
        }
Ejemplo n.º 3
0
        public void CreateEmailForward(long accountId, string domainIdentifier,
                                       string expectedUrl)
        {
            var client = new MockDnsimpleClient(CreateEmailForwardFixture);
            var record = new EmailForward
            {
                From = "*****@*****.**",
                To   = "*****@*****.**"
            };

            var created =
                client.Domains.CreateEmailForward(accountId, domainIdentifier,
                                                  record);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(17706, created.Data.Id);
                Assert.AreEqual(228963, created.Data.DomainId);
                Assert.AreEqual(record.From, created.Data.From);
                Assert.AreEqual(record.To, created.Data.To);

                Assert.AreEqual(expectedUrl, client.RequestSentTo());
            });
        }
 public TicketController(ITicketRepository dbContext, IConfiguration config, AppDbContext context)
 {
     _dbContext   = dbContext;
     _config      = config;
     _emailClient = new EmailForward(_config, _dbContext);
 }