public async Task <IActionResult> Edit(int id, [Bind("Id,CompanyName,ContactPerson,LicenseNo,Mobile,ContactNo,Email,Country,City")] BrokerRequirement brokerRequirement) { if (id != brokerRequirement.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(brokerRequirement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BrokerRequirementExists(brokerRequirement.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(brokerRequirement)); }
public IActionResult Edit(DriverBasicEditViewModel model) { if (ModelState.IsValid) { DriverBasic driverBasic = _context.DriverBasics.FirstOrDefault(e => e.Id == model.Id); driverBasic.Id = model.Id; driverBasic.FirstName = driverBasic.FirstName; driverBasic.LastName = driverBasic.LastName; driverBasic.EmiratesId = driverBasic.EmiratesId; driverBasic.WhatsappNo = driverBasic.WhatsappNo; driverBasic.MobileNo = driverBasic.MobileNo; driverBasic.InternationalNo = driverBasic.InternationalNo; driverBasic.Language = driverBasic.Language; //driverBasic.Picture = uniqueFileName; driverBasic.Nationality = driverBasic.Nationality; driverBasic.DateOfBirth = driverBasic.DateOfBirth; driverBasic.DateOfJoining = driverBasic.DateOfJoining; driverBasic.PassportNo = driverBasic.PassportNo; driverBasic.PassportExpiryDate = driverBasic.PassportExpiryDate; driverBasic.VisaExpiry = driverBasic.VisaExpiry; driverBasic.ResidenceCountry = driverBasic.ResidenceCountry; driverBasic.CityName = driverBasic.CityName; driverBasic.Address1 = driverBasic.Address1; driverBasic.Address2 = driverBasic.Address2; driverBasic.DriverType = driverBasic.DriverType; driverBasic.Company = driverBasic.Company; try { _context.Update(model); _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DriverExists(model.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(model)); //return View(student); }