public async Task <IActionResult> Edit(int id, [Bind("Id,Name,FullData,Price,Available_Members,Description")] Workshop workshop) { if (id != workshop.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workshop); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkshopExists(workshop.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(workshop)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Category category) { if (id != category.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Age,Email,PhoneNumber")] Customer customer) { if (id != customer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerRegistrationId,WorkshopId,CustomerId")] CustomerRegistration customerRegistration) { if (id != customerRegistration.CustomerRegistrationId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customerRegistration); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerRegistrationExists(customerRegistration.CustomerRegistrationId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "CustomerId", "Email", customerRegistration.CustomerId); ViewData["WorkshopId"] = new SelectList(_context.Workshop, "WorkshopId", "WorkshopName", customerRegistration.WorkshopId); return(View(customerRegistration)); }
public async Task <IActionResult> Edit(int id, [Bind("TeacherId,TeacherName")] Teacher teacher) { if (id != teacher.TeacherId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(teacher); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeacherExists(teacher.TeacherId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(teacher)); }
public async Task <IActionResult> Edit(int id, [Bind("WorkshopId,WorkshopName,CategoryId,FullData,Price,Available_Members,Description,TeacherId,Duration")] Workshop workshop) { if (id != workshop.WorkshopId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workshop); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkshopExists(workshop.WorkshopId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "CategoryName", workshop.CategoryId); ViewData["TeacherId"] = new SelectList(_context.Teacher, "TeacherId", "TeacherName", workshop.TeacherId); return(View(workshop)); }