public async Task <IActionResult> EditProvider(EditProviderViewModel model, int serviceId) { var groupItems = await GetGroupItems(); model.GroupItems = groupItems; if (model.Provider.Id == 0) { model.Provider.ServiceId = serviceId; using (var repo1 = new ServiceProviderRepository()) { await repo1.AddAsync(model.Provider); return(View(model)); } } var repo = new ServiceProviderRepository(); await repo.UpdateAsync(model.Provider); return(View(model)); }
public async Task<IActionResult> EditProvider(EditProviderViewModel model, int serviceId) { var groupItems = await GetGroupItems(); model.GroupItems = groupItems; if (model.Provider.Id == 0) { model.Provider.ServiceId = serviceId; using (var repo1 = new ServiceProviderRepository()) { await repo1.AddAsync(model.Provider); return View(model); } } var repo = new ServiceProviderRepository(); await repo.UpdateAsync(model.Provider); return View(model); }