public IActionResult OnGet() { if (Quote.Id != 0) { return(RedirectToPage("./Edit")); } Quote = new SamuraiApp.Domain.Quotes(); var list = samurairepo.GetSamurais().ToList().Select(x => new { Id = x.Id, SamuraiName = $"{x.Name}" }); Samurais = new SelectList(list, "Id", "SamuraiName"); return(Page()); }
public IActionResult OnPost(int?id) { if (id == null) { return(NotFound()); } Quote = repository.GetQuoteById(id.Value); if (Quote != null) { repository.Delete(Quote.Id); } repository.Commit(); return(RedirectToPage("./Index")); }
public IActionResult OnGet(int?id) { if (id == null) { return(NotFound()); } Quote = repository.GetQuoteById(id.Value); if (Quote == null) { return(NotFound()); } return(Page()); }