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