public async Task <IActionResult> Edit(Establishment model) { if (ModelState.IsValid) { Establishment e = await _establishmentRepository.GetByIdAsync(model.Id); // Update the establishment object with the data in the model object e.Name = model.Name; e.Phone = model.Phone; e.Address1 = model.Address1; e.Address2 = model.Address2; e.City = model.City; e.ProvState = model.ProvState; e.PostalZip = model.PostalZip; e.Country = model.Country; e.UrlWebsite = model.UrlWebsite; e.UrlInstagram = model.UrlInstagram; e.UrlFacebook = model.UrlFacebook; e.UrlTwitter = model.UrlTwitter; e.UrlMenu = model.UrlMenu; // Call update method on the repository service passing it the // sl object to update the data in the database table Establishment establishment = await _establishmentRepository.UpdateAsync(e); return(RedirectToAction("Index", "Establishment")); } return(View(model)); }