public IActionResult Save(int id, string title, string description) { if (this.CurrentUserIsAdministrator()) { ExamTypeBuilder builder = new ExamTypeBuilder(this.DatabaseContext, this.DatabaseContext.ExamTypeForId(id)); builder.Title = title; builder.Save(); } return(RedirectToAction("index")); }
public IActionResult Edit(int?id) { if (this.CurrentUserIsAdministrator()) { ExamType examType; if (id.HasValue) { examType = this.DatabaseContext.ExamTypeForId(id.Value); } else { ExamTypeBuilder examTypeBuilder = new ExamTypeBuilder(this.DatabaseContext); examTypeBuilder.Title = "Neue Prüfungsart"; examTypeBuilder.Save(); examType = examTypeBuilder.ExamType(); } return(View(examType)); } else { return(RedirectToAction("index")); } }