Beispiel #1
0
        private CreateIssue CreateIssueModel(CreateIssue model, bool isModal)
        {
            if (model == null)
            {
                model = new CreateIssue { IsModal = isModal };
            }

            model.IssueTypeOptions = PopulateIssueTypes(model);

            return model;
        }
Beispiel #2
0
 public ActionResult CreateIssue(CreateIssue model)
 {
     if (!ModelState.IsValid && model.IsModal)
     {
         return PartialView("CreateIssue", CreateIssueModel(model, true));
     }
     else if (!ModelState.IsValid)
     {
         return PartialView("CreateIssue", CreateIssueModel(model, false));
     }
     else if (model.IsModal)
     {
         return Content("OK");
     }
     else
     {
         return RedirectToAction("Index", "Home");
     }
 }
Beispiel #3
0
        private IEnumerable<SelectListItem> PopulateIssueTypes(CreateIssue model = null)
        {
            Dictionary<int, string> issues = new Dictionary<int, string> { { 0, "Story" }, { 1, "Task" }, { 2, "Test Task" }, { 3, "Bug" } };

            return issues.AsEnumerable().ToSelectListItems(value => value.Key.ToString(), text => text.Value, selected => model != null && model.IssueType == selected.Key);
        }