public async Task <IActionResult> Edit(int id, [Bind("EnrollmentID,CourseID,StudentID,Grade")] Enrollment enrollment) { if (id != enrollment.EnrollmentID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(enrollment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EnrollmentExists(enrollment.EnrollmentID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CourseID"] = new SelectList(_context.Courses, "CourseID", "CourseID", enrollment.CourseID); ViewData["StudentID"] = new SelectList(_context.Students, "ID", "Discriminator", enrollment.StudentID); return(View(enrollment)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Risk,StartTime,EndTime,VehicleModelID,CustomerModelID")] VehiclePolicyModel vehiclePolicyModel) { if (id != vehiclePolicyModel.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vehiclePolicyModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehiclePolicyModelExists(vehiclePolicyModel.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["VehicleModelID"] = new SelectList(_context.Vehicles, "ID", "ID", vehiclePolicyModel.VehicleModelID); ViewData["CustomerModelID"] = new SelectList(_context.Customers, "ID", "ID", vehiclePolicyModel.CustomerModelID); return(View(vehiclePolicyModel)); }
public async Task <IActionResult> Edit(int id, [Bind("CompanyId,CompanyName,Logo,StreetAndNumber,PostalCode,City,Country,PhoneNumber,Email")] CompanyModel companyModel) { if (id != companyModel.CompanyId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(companyModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyModelExists(companyModel.CompanyId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(companyModel)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,RegistrationNumber,Type,CarBrand,CarModel,EngineCapacity,MaxLoad,MaxWeight,CustomerModelID")] VehicleModel vehicleModel) { if (id != vehicleModel.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vehicleModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehicleModelExists(vehicleModel.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerModelID"] = new SelectList(_context.Customers, "ID", "ID", vehicleModel.CustomerModelID); return(View(vehicleModel)); }
public async Task <IActionResult> Edit(int id, [Bind("CourseID,Title,Credits,DepartmentID")] Course course) { if (id != course.CourseID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(course); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(course.CourseID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DepartmentID"] = new SelectList(_context.Departments, "DepartmentID", "DepartmentID", course.DepartmentID); return(View(course)); }
public async Task <IActionResult> Edit(int id, int departmentId, [Bind("WorkHoursId,StartHour,StartMinutes,EndHour,EndMinutes,DayName,AdditionalInfo,Date")] WorkHoursModel workHoursModel) { if (id != workHoursModel.WorkHoursId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(workHoursModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WorkHoursModelExists(workHoursModel.WorkHoursId)) { return(NotFound()); } else { throw; } } return(Redirect($"/Calendar/Display?departmentId={departmentId}")); } return(View(workHoursModel)); }
public async Task <IActionResult> Edit(int id, ProductModel productModel) { if (id != productModel.ID) { return(NotFound()); } var productDb = await _context.Products .SingleOrDefaultAsync(m => m.ID == id); productDb.ProductName = productModel.ProductName; productDb.Localization = productModel.Localization; productDb.Price = productModel.Price; productDb.ProducentAdress = productModel.ProducentAdress; productDb.ProducentName = productModel.ProducentName; productDb.TechnicalParameters = productModel.TechnicalParameters; if (ModelState.IsValid) { try { _context.Update(productDb); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductModelExists(productDb.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(productModel)); }
public async Task UpdateCustomer(CustomerModel customerModel) { _context.Update(customerModel); await _context.SaveChangesAsync(); }