public IActionResult Save(int id, string title, string description) { if (this.CurrentUserIsAdministrator()) { SkillBuilder skillBuilder = new SkillBuilder(this.DatabaseContext, this.DatabaseContext.SkillForId(id)); skillBuilder.Title = title; skillBuilder.Description = description; skillBuilder.Save(); } return(RedirectToAction("index")); }
public IActionResult Edit(int?id) { if (this.CurrentUserIsAdministrator()) { Skill skill; if (id.HasValue) { skill = this.DatabaseContext.SkillForId(id.Value); } else { SkillBuilder skillBuilder = new SkillBuilder(this.DatabaseContext); skillBuilder.Title = "Skill"; skillBuilder.Description = "Bescheibung"; skillBuilder.Save(); skill = skillBuilder.Skill(); } return(View(skill)); } else { return(RedirectToAction("index")); } }