public ActionResult AssignDev(int ticketId) { var model = new AssignDevTicketModel(); var ticket = db.Ticket.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 AssignDev(AssignDevTicketModel model) { var ticket = db.Ticket.FirstOrDefault(p => p.Id == model.TicketId); ticket.AssigneeId = model.SelectedDeveloperId; db.SaveChanges(); var user = db.Users.FirstOrDefault(p => p.Id == model.SelectedDeveloperId); var personalEmailService = new PersonalEmailService(); var mailMessage = new MailMessage( WebConfigurationManager.AppSettings["emailto"], user.Email ); mailMessage.Body = "New Assignee"; mailMessage.Subject = "Assignee to Developer"; mailMessage.IsBodyHtml = true; personalEmailService.Send(mailMessage); return(RedirectToAction("Index")); }