// 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(Team).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamExists(Team.TeamId)) { 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() { // Checking user's logged in role string username = HttpContext.Session.GetString("username"); if (username == null) { return(RedirectToPage("/Privacy")); } AppCondition app = await _context.AppCondition.FirstOrDefaultAsync(app => app.AppConditionId.Equals(1)); if (username == app.AdminName) { isAdmin = true; } else { isAdmin = false; } if (!ModelState.IsValid) { EventsList = await _context.Event.ToListAsync(); return(Page()); } _context.Attach(Theme).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ThemeExists(Theme.ThemeId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }