Ejemplo n.º 1
0
        public ActionResult Create(CreateIssueForm model)
        {
            if (ModelState.IsValid)
            {
                var assignedUser = _context.Users.Single(r => r.Id == model.AssignedToId);
                var newIssue = new Issue(_currentUser.User, model.Subject, model.Body, assignedUser, model.IssueType);

                _context.Issues.Add(newIssue);

                if (assignedUser.Assignments == null) assignedUser.Assignments = new List<Issue>();

                assignedUser.Assignments.Add(newIssue);

                _context.SaveChanges();
                //return RedirectToAction("Index");
                return RedirectToAction<IssueController>(x => x.Index()).WithSuccess("Issue Created!");
            }

            return View(model);
        }
Ejemplo n.º 2
0
        public ActionResult Create(CreateIssueForm model)
        {
            if (ModelState.IsValid)
            {
                var assignedUser = _context.Users.Single(r => r.Id == model.AssignedToId);
                var newIssue     = new Issue(_currentUser.User, model.Subject, model.Body, assignedUser, model.IssueType);

                _context.Issues.Add(newIssue);

                if (assignedUser.Assignments == null)
                {
                    assignedUser.Assignments = new List <Issue>();
                }

                assignedUser.Assignments.Add(newIssue);

                _context.SaveChanges();
                //return RedirectToAction("Index");
                return(RedirectToAction <IssueController>(x => x.Index()).WithSuccess("Issue Created!"));
            }

            return(View(model));
        }
Ejemplo n.º 3
0
 public IActionResult SubmitIssue([FromForm] CreateIssueForm form)
 {
     // This does nothing, obviously, but could submit the issue internally.
     return(Redirect("Thanks"));
 }