public IActionResult OnGet() { Battle = new SamuraiApp.Domain.Battle(); if (Battle.Id != 0) { return(RedirectToPage("./Edit")); } return(Page()); }
public IActionResult OnGet(int?id) { if (id == null) { return(NotFound()); } Battle = repository.GetBattlesById(id.Value); if (Battle == null) { return(NotFound()); } return(Page()); }
public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Battle = repository.GetBattlesById(id.Value); if (Battle != null) { Battle = repository.Delete(Battle.Id); } repository.Commit(); return(RedirectToPage("./Index")); }
public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } if (Battle.Id == 0) { Battle = repository.Create(Battle); } else { Battle = repository.Update(Battle); } repository.Commit(); return(RedirectToPage("./Index")); }