Beispiel #1
0
		public async Task<IActionResult> EditProvider(int id)
		{
			var groupItems = await GetGroupItems();

			var repo = new ServiceProviderRepository();
			var provider = await repo.GetByIdAsync(id);
			var model = new EditProviderViewModel
			{
				Provider = provider,
				GroupItems = groupItems,
			};
			repo.Dispose();

			return View(model);
		}
Beispiel #2
0
		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);
		}