public IActionResult OnPostCreate(int id) { var ticket = new Models.Ticket() { TicketSubject = Input.TicketSubject, TicketDetails = Input.TicketDetails, TicketRequestor = User.Identity.Name, TicketDate = DateTime.Now, PriorityType = Input.TicketPriority, StatusType = Models.Status.Open, ProductType = Input.TicketProduct }; m_ticketService.AddTicket(ticket); var user = new ApplicationUser { UserName = Input.TicketRequestor, Email = Input.TicketRequestor }; var result = m_userManager.CreateAsync(user).Result; if (result.Succeeded) { //add user to role var test2 = m_userManager.AddToRoleAsync(user, "Customer").Result; //new account has been created //stuur een Email confirmatie mail .... var code = m_userManager.GenerateEmailConfirmationTokenAsync(user).Result; var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme); m_mailmanager.SendEmailConfirmationAsync(Input.TicketRequestor, callbackUrl, Input.TicketRequestor); // zorg ervoor dat de gebruiker hier ook zijn passwoord kan setten } else { //account already in DB //stuur mail dat er een ticket is aangemaakt SendMailTicketCreate(ticket.TicketId); } if (Input.Delete == true) { m_emailReceiver.DeleteMailTicket(id); } return(Redirect("../../Tickets/MyTickets")); }
//Delete ticket public IActionResult OnPost(int id) { MailTicket = m_emailReceiver.DeleteMailTicket(id); return(RedirectToPage("../Tickets/MyTickets")); }