public async Task <IActionResult> Edit(Guid id, [Bind("Id,Company,CountryCode,StateProvinceCode,StreetAddress,CityTown,ZipPostalCode,TimeStamp")] CompanyLocations companyLocations) { if (id != companyLocations.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(companyLocations); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CompanyLocationsExists(companyLocations.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Company"] = new SelectList(_context.CompanyProfiles, "Id", "ContactPhone", companyLocations.Company); return(View(companyLocations)); }
public async Task <IActionResult> Create([Bind("CountryCode,StateProvinceCode,StreetAddress,CityTown,ZipPostalCode")] CompanyLocations companyLocations, Guid id) { companyLocations.Company = id; if (ModelState.IsValid) { companyLocations.Id = Guid.NewGuid(); _context.Add(companyLocations); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), "CompanyProfiles")); } ViewData["Company"] = new SelectList(_context.CompanyProfiles, "Id", "ContactPhone", companyLocations.Company); return(View(companyLocations)); }