//public ActionResult Create([Bind(Include = "Id,Title,Description,Created,Updated,ProjectId,TicketTypeId,TicketPriorityId,TicketStatusId,OwnerUserId,AssignedToUserId")] Ticket ticket) public ActionResult Create(string title, string description, int projectId, int TicketTypeId, int TicketPriorityId, int TicketStatusId) { //ViewBag.AssignedToUserId = new SelectList(db.Users, "Id", "Email", ticket.AssignedToUserId); //ViewBag.OwnerUserId = new SelectList(db.Users, "Id", "Email", ticket.OwnerUserId); //ViewBag.ProjectId = new SelectList(db.Projects, "Id", "Name"); ViewBag.TicketPriorityId = new SelectList(db.TicketPriorities, "Id", "Name"); ViewBag.TicketStatusId = new SelectList(db.TicketStatuses, "Id", "Name"); ViewBag.TicketTypeId = new SelectList(db.TicketTypes, "Id", "Name"); if (ModelState.IsValid) { TicketHelper.Create(User.Identity.GetUserId(), title, description, projectId, TicketTypeId, TicketPriorityId, TicketStatusId); return(RedirectToAction("ShowMyProjects", "Projects")); } return(RedirectToAction("ShowMyProjects", "Projects")); //return View(ticket); }
public ActionResult CreateTicket(string title, string description, int projectId, int TicketTypeId, int TicketPriorityId, int TicketStatusId) { var user = db.Users.Find(User.Identity.GetUserId()); var projects = db.Projects.Where(p => p.ProjectUsers.Any(pu => pu.UserId == user.Id)).ToList(); ViewBag.ProjectId = new SelectList(projects, "Id", "Name"); ViewBag.TicketPriorityId = new SelectList(db.TicketPriorities, "Id", "Name"); ViewBag.TicketStatusId = new SelectList(db.TicketStatuses, "Id", "Name"); ViewBag.TicketTypeId = new SelectList(db.TicketTypes, "Id", "Name"); if (ModelState.IsValid) { TicketHelper.Create(User.Identity.GetUserId(), title, description, projectId, TicketTypeId, TicketPriorityId, TicketStatusId); return(RedirectToAction("Index")); } return(RedirectToAction("Index")); }
public ActionResult Create(string Title, string Description, int TicketTypeId, int TicketPriorityId) { TicketHelper.Create(Title, Description, TicketTypeId, TicketPriorityId); return(RedirectToAction("Index")); }