public async Task <IActionResult> Edit(int id, [Bind("LE_Index,LocationIndex,Email")] LocationEmail locationEmail) { if (id != locationEmail.LE_Index) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(locationEmail); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocationEmailExists(locationEmail.LE_Index)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LocationIndex"] = new SelectList(_context.LocationSetting, "locationIndex", "Location", locationEmail.LocationIndex); return(View(locationEmail)); }
public async Task <IActionResult> Create([Bind("LE_Index,LocationIndex,Email")] LocationEmail locationEmail) { if (ModelState.IsValid) { _context.Add(locationEmail); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["LocationIndex"] = new SelectList(_context.LocationSetting, "locationIndex", "Location", locationEmail.LocationIndex); return(View(locationEmail)); }