public IActionResult OnPost() { //if Location with empty string will be handled //ModelState["Location"].Errors; Cusines = _htmlHelper.GetEnumSelectList <Core.CuisineType>(); if (!ModelState.IsValid) { //if all info that passed in via model binding are not valid ? //update data return(Page()); } if (Restaurant.Id > 0) { _restaurantData.Update(Restaurant); } else { _restaurantData.AddOrCreate(Restaurant); } _restaurantData.Commit(); //Dictionary TempData["Message"] = "Restaurant Saved Successfully!"; return(RedirectToPage("./Details", new { restaurantId = Restaurant.Id })); }