public async Task UpdateDriver(DriverUpdateVm driver) { BudAkutenUsers d = await idctx.Users.Where(p => p.UserName == driver.UserName).SingleOrDefaultAsync(); d.Email = driver.Email; d.StreetAdress = driver.StreetAdress; d.ZipCode = driver.ZipCode; d.City = driver.City; d.PhoneNumber = driver.PhoneNumber; d.UserName = driver.UserName; var driver2 = await appctx.Driver.Where(p => p.AspNetUsersId == d.Id).SingleOrDefaultAsync(); driver2.Description = driver.Description; driver2.A = driver.A; driver2.B = driver.B; driver2.C = driver.C; driver2.Ce = driver.CE; driver2.D = driver.D; driver2.FirstName = driver.FirstName; driver2.LastName = driver.LastName; await appctx.SaveChangesAsync(); await idctx.SaveChangesAsync(); }
public async Task <IActionResult> Update(DriverUpdateVm driver) { if (!ModelState.IsValid) { return(View()); } var u = User.Identity.Name; await driverSer.UpdateDriver(driver); return(RedirectToAction(nameof(Details))); }
public async Task <DriverUpdateVm> GetDriverForUpdate(string name) { var driver = await GetDriverByUserName(name); DriverUpdateVm d = new DriverUpdateVm(); d.A = driver.A; d.B = driver.B; d.C = driver.C; d.CE = driver.CE; d.D = driver.D; d.City = driver.City; d.Description = driver.Description; d.Email = driver.Email; d.FirstName = driver.FirstName; d.LastName = driver.LastName; d.PhoneNumber = driver.PhoneNumber; d.StreetAdress = driver.StreetAdress; d.UserName = driver.UserName; d.ZipCode = driver.ZipCode; return(d); }