public async Task <bool> EditOtterAsync(Otter otter, string UserID) { string[] data; data = otter.PlaceName.Split(';'); Otter = new Otter() { TattooID = otter.TattooID, Name = otter.Name, Color = otter.Color, MotherId = otter.MotherId, PlaceName = data[0], LocationId = int.Parse(data[1]), founderID = otter.founderID }; _context.Attach(Otter).State = EntityState.Modified; try { await _context.SaveChangesAsync(); return(true); } catch (DbUpdateConcurrencyException) { throw; } }
public async Task <IActionResult> OnPostAsync() { string[] data; data = otter.PlaceName.Split(';'); otter.LocationId = int.Parse(data[0]); otter.PlaceName = data[1]; _context.Attach(otter).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VydraExists(otter.TattooID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("../Index")); }
public async Task <IActionResult> OnPostAsync() { _context.Attach(location).State = EntityState.Modified; await _context.SaveChangesAsync(); return(RedirectToPage("../LocationIndex")); }