// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync(int?id) { var TerminaltoUpdate = await _context.accTerminal.FindAsync(id); if (await TryUpdateModelAsync <accTerminal>( TerminaltoUpdate, "terminal", // Prefix for form value. s => s.IdTerminal, s => s.idZone, s => s.Name)) { _context.accTerminal.Update(TerminaltoUpdate); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TerminalExists(Terminal.IdTerminal)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); } // Select DepartmentID if TryUpdateModelAsync fails. PopulateZonesDropDownList(_context, TerminaltoUpdate.idZone); return(Page()); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Zone).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ZoneExists(Zone.IdZone)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.accZone.Add(Zone); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Terminal = await _context.accTerminal.FindAsync(id); if (Terminal != null) { _context.accTerminal.Remove(Terminal); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Zone = await _context.accZone.FindAsync(id); if (Zone != null) { _context.accZone.Remove(Zone); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { var emptyTerminal = new accTerminal(); if (await TryUpdateModelAsync <accTerminal>( emptyTerminal, "terminal", // Prefix for form value. s => s.IdTerminal, s => s.idZone, s => s.Name)) { _context.accTerminal.Add(emptyTerminal); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); } // Select DepartmentID if TryUpdateModelAsync fails. PopulateZonesDropDownList(_context, emptyTerminal.idZone); return(Page()); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync(int?id, string[] selectedZones) { if (id == null) { return(NotFound()); } var UserToUpdate = await _context.accUser .Include(i => i.UserZones) .ThenInclude(i => i.zone) .FirstOrDefaultAsync(s => s.idUser == id); if (UserToUpdate == null) { return(NotFound()); } if (await TryUpdateModelAsync <accUser>( UserToUpdate, "User", i => i.FirstName, i => i.LastName, i => i.dateIni, i => i.dateEnd, i => i.UserZones, i => i.Uid )) { UpdateUserZones(_context, selectedZones, UserToUpdate); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); } UpdateUserZones(_context, selectedZones, UserToUpdate); PopulateAssignedZoneData(_context, UserToUpdate); return(Page()); }