public ActionResult Create(CreateModel model) { if (!ModelState.IsValid) { return this.View(model); } if (this.assessmentIndex.ContainsName(model.Name)) { ModelState.AddModelError("Name", "You've already got another assessment with this name."); return this.View(model); } var assessment = this.assessmentsRepo.Create(); assessment.SetName(model.Name); this.assessmentIndex.Set(assessment.Id, assessment.Name); return this.RedirectToAction("Index", "Assessments"); }
// GET: /Assessment/Create public ActionResult Create() { var model = new CreateModel(); return this.View(model); }