Example #1
0
 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"));
 }
Example #2
0
 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"));
     }
 }