public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Weapon).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WeaponExists(Weapon.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./AllWeapons")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Weapons.Add(Weapon); await _context.SaveChangesAsync(); return(RedirectToPage("./AllWeapons")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Armors.Add(Armor); await _context.SaveChangesAsync(); //TODO ./AllArmors return(RedirectToPage("./AllArmors")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Armor = await _context.Armors.FindAsync(id); if (Armor != null) { _context.Armors.Remove(Armor); await _context.SaveChangesAsync(); } return(RedirectToPage("./AllArmors")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Creep = await _context.Creeps.FindAsync(id); if (Creep != null) { _context.Creeps.Remove(Creep); await _context.SaveChangesAsync(); } return(RedirectToPage("./AllCreeps")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Weapon = await _context.Weapons.FindAsync(id); if (Weapon != null) { _context.Weapons.Remove(Weapon); await _context.SaveChangesAsync(); } return(RedirectToPage("./AllWeapons")); }
public async Task <IActionResult> OnPostAsync() { Types = new List <SelectListItem> { new SelectListItem { Value = "Fire", Text = "Fire" }, new SelectListItem { Value = "Nature", Text = "Nature" }, new SelectListItem { Value = "Water", Text = "Water" } }; if (!ModelState.IsValid) { return(Page()); } _context.Attach(Creep).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CreepExists(Creep.Id)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./AllCreeps")); }
public async Task <IActionResult> OnPostAsync() { Types = new List <SelectListItem> { new SelectListItem { Value = "Fire", Text = "Fire" }, new SelectListItem { Value = "Nature", Text = "Nature" }, new SelectListItem { Value = "Water", Text = "Water" } }; if (!ModelState.IsValid) { return(Page()); } _context.Creeps.Add(Creep); await _context.SaveChangesAsync(); return(RedirectToPage("./AllCreeps")); }