Ejemplo n.º 1
0
        public IActionResult OnPost(int restaurauntId)
        {
            var restauraunt = restaurauntData.Delete(restaurauntId);

            restaurauntData.Commit();

            if (restauraunt == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            TempData["Message"] = $"{restauraunt.Name} deleted";
            return(RedirectToPage("./List"));
        }
Ejemplo n.º 2
0
        public IActionResult OnPost()
        {
            if (!ModelState.IsValid)
            {
                Cuisines = htmlHelper.GetEnumSelectList <CuisineType>();
                return(Page());
            }

            if (Restauraunt.Id > 0)
            {
                restaurauntData.Update(Restauraunt);
            }
            else
            {
                restaurauntData.Add(Restauraunt);
            }
            restaurauntData.Commit();
            TempData["Message"] = "Restauraunt saved!";
            return(RedirectToPage("./Detail", new { restaurauntId = Restauraunt.Id }));
        }