public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Locations).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocationsExists(Locations.LocationId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
/*public async Task OnGetAsync() * { * Tasks = await _context.Tasks * Include(t => t.ProjectId).ToListAsync(); * * if (QueryProjectId != null) * { * if (int.TryParse(QueryProjectId, out var ParsedProjectId)) * { * Tasks = Tasks.Where(i => i.ProjectId == ParsedProjectId).ToList(); * } * } * }*/ public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Tasks.Add(Tasks); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Tasks = await _context.Tasks.FindAsync(id); if (Tasks != null) { _context.Tasks.Remove(Tasks); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task<IActionResult> OnPostAsync(int? id) { if (id == null) { return NotFound(); } CostTypes = await _context.CostTypes.FindAsync(id); if (CostTypes != null) { _context.CostTypes.Remove(CostTypes); await _context.SaveChangesAsync(); } return RedirectToPage("./Index"); }
public async Task <IActionResult> OnPostAsync(string id) { if (id == null) { return(NotFound()); } AspNetUserRoles = await _context.AspNetUserRoles.FindAsync(id); if (AspNetUserRoles != null) { _context.AspNetUserRoles.Remove(AspNetUserRoles); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }