Esempio n. 1
0
        public async Task <IActionResult> Edit(Page page)
        {
            if (ModelState.IsValid)
            {
                //return View(page);

                context.Update(page);
                await context.SaveChangesAsync();

                TempData["Success"] = "The page has been edited!";

                return(RedirectToAction("Edit", new { id = page.Id }));
            }

            return(View(page));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, SportsCategory category)
        {
            if (ModelState.IsValid)
            {
                context.Update(category);
                await context.SaveChangesAsync();

                TempData["Success"] = "The category has been edited!";

                return(RedirectToAction("Edit", new { id }));
            }

            return(View(category));
        }