public IActionResult OnPost() { if (!ModelState.IsValid) { Cuisines = htmlHelper.GetEnumSelectList <CuisineType>(); return(Page()); //restaurantData.Update(Restaurant); //restaurantData.Commit(); //return RedirectToPage("./Detail", new { restaurantId = Restaurant.Id }); } // Restaurant=restaurantData.Update(Restaurant); // use for update // restaurantData.Update(Restaurant); // use for update // return update page if (College.Id > 0) { collegeData.Update(College); } else { collegeData.Add(College); } collegeData.Commit(); TempData["Message"] = "College Saved!"; return(RedirectToPage("./Detail", new { collegeId = College.Id })); }
public IActionResult OnPost(int collegeId) { var college = collegeData.Delete(collegeId); collegeData.Commit(); if (college == null) { return(RedirectToPage("./NotFound")); } TempData["Message"] = $"{college.Name} Deleted."; return(RedirectToPage("./List")); }
public IActionResult OnPost() { if (!ModelState.IsValid) { DepartmentOfCollege = htmlHelper.GetEnumSelectList <DepartmentOfCollege>(); return(Page()); } if (College.Id > 0) { collegeData.Update(College); } else { collegeData.Add(College); } TempData["Message"] = "Restaurant is saved!"; collegeData.Commit(); return(RedirectToPage("./Detail", new { RestaurantId = College.Id })); }