public async Task <IActionResult> Edit(long id, [Bind("Id,Name,Address,LogoUrl")] MyapiRestaurant myapiRestaurant) { if (id != myapiRestaurant.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(myapiRestaurant); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MyapiRestaurantExists(myapiRestaurant.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(myapiRestaurant)); }
public async Task <IActionResult> Create([Bind("Id,Name,Address,LogoUrl")] MyapiRestaurant myapiRestaurant) { if (ModelState.IsValid) { _context.Add(myapiRestaurant); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(myapiRestaurant)); }