public IActionResult OnPost(int bikeId) { var bike = bikeData.Delete(bikeId); bikeData.Commit(); if (bike == null) { return(RedirectToPage("./NotFound")); } TempData["Message"] = $"{bike.Model} deleted"; return(RedirectToPage("./List")); }
public IActionResult OnPost() { if (!ModelState.IsValid) { Manufacturers = htmlHelper.GetEnumSelectList <Bike.BikeManufacturer>(); return(Page()); } if (Bike.Id > 0) { bikeData.Update(Bike); } else { bikeData.Add(Bike); } bikeData.Commit(); TempData["Message"] = "Bike saved!"; return(RedirectToPage($"./Detail", new { bikeId = Bike.Id, ResultMessage = "Bike saved" })); }