public void UpdateTicket(SupportTicketViewModel ticket) { var ticketModel = _supportTicketRepository.FindById(ticket.Id); ticketModel.Status = ticket.Status; _supportTicketRepository.Update(ticketModel); }
public async Task <IActionResult> OpenTicket(SupportTicketViewModel ticketInfo) { if (!ModelState.IsValid || ticketInfo.BillId == 0) { ModelState.AddModelError(string.Empty, string.Empty); return(RedirectToAction(nameof(TicketController.OpenTicket))); } if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account")); } var userId = (await _userManager.FindByNameAsync(User.Identity.Name)).Id; var isTickerSent = _supportTicketService.isTicketexisted(userId, ticketInfo.BillId); if (isTickerSent) { return(RedirectToAction(nameof(TicketController.TicketError), new { id = ticketInfo.BillId })); } ticketInfo.UserId = userId; _supportTicketService.Add(ticketInfo); _supportTicketService.Save(); // send email confirm to customer await _emailSender.SendTicket(ticketInfo.Email, ticketInfo.BillId); await _emailSender.SendTicket(CommonConstants.mailAdmin, ticketInfo.BillId); return(RedirectToAction(nameof(TicketController.SendTicketSuccess), new { id = ticketInfo.BillId })); }
public PartialViewResult GetSupportTicketDetails(string supportTicketID) { HelpDeskDatabase db = new HelpDeskDatabase(); SupportTicketViewModel model = new SupportTicketViewModel(); model.SupportTicket = db.SupportTickets.Find(Int32.Parse(supportTicketID)); return(PartialView("_SupportTicketDetails", model)); }
public void Add(SupportTicketViewModel ticketVm) { var ticket = Mapper.Map <SupportTicketViewModel, SupportTicket>(ticketVm); _supportTicketRepository.Add(ticket); }