public async Task <IActionResult> Edit(int id, [Bind("Id,Image,Title,About,Description")] AboutResturant aboutResturant) { if (User.Identity.IsAuthenticated == false) { return(RedirectToAction("Login", "Identity")); } if (id != aboutResturant.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(aboutResturant); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AboutResturantExists(aboutResturant.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(aboutResturant)); }
public async Task <IActionResult> Create([Bind("Id,Image,Title,About,Description")] AboutResturant aboutResturant) { if (User.Identity.IsAuthenticated == false) { return(RedirectToAction("Login", "Identity")); } if (ModelState.IsValid) { _context.Add(aboutResturant); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(aboutResturant)); }