public ActionResult AssignDeveloper(int ticketId) { var model = new AssignDevelopersTicketModel(); var ticket = db.Tickets.FirstOrDefault(p => p.Id == ticketId); var userRoleHelper = new UserRoleHelper(); var users = userRoleHelper.UsersInRole("Developer"); model.TicketId = ticketId; model.DeveloperList = new SelectList(users, "Id", "Name"); return(View(model)); }
public ActionResult AssignDeveloper(AssignDevelopersTicketModel model) { var ticket = db.Tickets.FirstOrDefault(p => p.Id == model.TicketId); ticket.AssigneeId = model.SelectedDeveloperId; var user = db.Users.FirstOrDefault(p => p.Id == model.SelectedDeveloperId); var personalEmailService = new PersonalEmailServices(); var mailMessage = new MailMessage(WebConfigurationManager.AppSettings["emailto"], user.Email); mailMessage.Body = "Someone Assign you a ticket"; mailMessage.Subject = "Assign"; mailMessage.IsBodyHtml = true; personalEmailService.Send(mailMessage); db.SaveChanges(); return(RedirectToAction("Index")); }