public async Task <IActionResult> Edit(int id, [Bind("FleetCategoryId,NumberPlate,Model,Year,Cost,TagNumber,Mileage,COFId,DepartmentId,InsuranceId,StationId,COMUL")] FleetCategory fleetCategory) { if (id != fleetCategory.FleetCategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fleetCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FleetCategoryExists(fleetCategory.FleetCategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["COFId"] = new SelectList(_context.COF, "COFId", "COFNumber", fleetCategory.COFId); ViewData["DepartmentId"] = new SelectList(_context.Department, "DepartmentId", "Comment", fleetCategory.DepartmentId); ViewData["InsuranceId"] = new SelectList(_context.Insurance, "InsuranceId", "Details", fleetCategory.InsuranceId); ViewData["StationId"] = new SelectList(_context.Station, "StationId", "StationName", fleetCategory.StationId); return(View(fleetCategory)); }
/// <summary> /// This event fires when the user click on the Cancel Button /// It turns off all the controls to make up Crews /// It deletes the crew that is currently being formed /// It refreshes the Current Crews List /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Cancel_Click(object sender, EventArgs e) { EmployeeGridView.Visible = false; SelectUnitDDL.Visible = false; FleetCategory.ClearSelection(); Done.Visible = false; Cancel.Visible = false; CreateCrew.Visible = false; MakeCrew.Visible = true; LastCrews.Visible = true; FleetCategory.Visible = false; //Deletes the crew in formation. InfoUserControl.TryRun(() => { if (!string.IsNullOrEmpty(CrewID.Text)) { int crewId = int.Parse(CrewID.Text); CrewController crewManager = new CrewController(); crewManager.DeleteCrew(crewId); CrewID.Text = ""; RefreshCurrentCrews(); } }); }
protected void CloseCrewPane() { RefreshCrewMember(); RefreshCurrentCrews(); EmployeeGridView.Visible = false; SelectUnitDDL.Visible = false; FleetCategory.ClearSelection(); Done.Visible = false; CreateCrew.Visible = false; Cancel.Visible = false; }
public async Task <IActionResult> Create([Bind("FleetCategoryId,NumberPlate,Model,Year,Cost,TagNumber,Mileage,COFId,DepartmentId,InsuranceId,StationId,COMUL")] FleetCategory fleetCategory) { if (ModelState.IsValid) { _context.Add(fleetCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["COFId"] = new SelectList(_context.COF, "COFId", "COFNumber", fleetCategory.COFId); ViewData["DepartmentId"] = new SelectList(_context.Department, "DepartmentId", "Comment", fleetCategory.DepartmentId); ViewData["InsuranceId"] = new SelectList(_context.Insurance, "InsuranceId", "Details", fleetCategory.InsuranceId); ViewData["StationId"] = new SelectList(_context.Station, "StationId", "StationName", fleetCategory.StationId); return(View(fleetCategory)); }