// GET: CharClass/Details/5 public ActionResult Details(int id) { var service = new CharClassServices(); var model = service.GetClassById(id); return(View(model)); }
// GET: CharClass public ActionResult Index() { var service = new CharClassServices(); var model = service.GetClasses(); return(View(model)); }
// GET: CharClass/Delete/5 public ActionResult Delete(int id) { var service = new CharClassServices(); var model = service.DeleteClass(id); return(View(model)); }
public ActionResult DeleteConfirmed(int id) { var service = new CharClassServices(); if (service.DeleteClass(id)) { return(RedirectToAction("Index")); } return(RedirectToAction("Delete", new { id })); }
// GET: Character/Create public ActionResult Create() { var charRaceService = new CharRaceServices(); var raceList = charRaceService.GetRaces(); ViewBag.CharRaceID = new SelectList(raceList, "ID", "RaceName"); var charClassService = new CharClassServices(); var classList = charClassService.GetClasses(); ViewBag.CharClassID = new SelectList(classList, "ID", "ClassName"); return(View()); }
// GET: CharClass/Edit/5 public ActionResult Edit(int id) { var service = new CharClassServices(); var detail = service.GetClassById(id); var model = new CharClassEdit { ID = detail.ID, ClassName = detail.ClassName, SpellCaster = detail.SpellCaster, HitPointsFirstLevel = detail.HitPointsFirstLevel, Proficiencies = detail.Proficiencies }; return(View(model)); }
public ActionResult Edit(CharClassEdit model) { if (!ModelState.IsValid) { return(View(model)); } var service = new CharClassServices(); if (service.UpdateClass(model)) { return(RedirectToAction("Index")); } ModelState.AddModelError("", "Class could not be edited."); return(View(model)); }
public ActionResult Create(CharClassCreate model) { if (!ModelState.IsValid) { return(View(model)); } var service = new CharClassServices(); if (service.Create(model)) { return(RedirectToAction("Index")); } ModelState.AddModelError("", "Class could not be added"); return(View(model));; }
// GET: Character/Edit/5 public ActionResult Edit(int id) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CharService(userId); var charClassService = new CharClassServices(); var classList = charClassService.GetClasses(); ViewBag.CharClassID = new SelectList(classList, "ID", "ClassName"); var detail = service.GetCharacterById(id); var model = new CharDetail { CharName = detail.CharName, CharClassID = detail.CharClassID, Alignment = detail.Alignment, CharHistory = detail.CharHistory, ExperiencePoints = detail.ExperiencePoints, Traits = detail.Traits, Level = detail.Level, }; return(View(model)); }