Beispiel #1
0
 public IActionResult OnGet()
 {
     if (!HttpContext.Session.GetInt32("UserID").HasValue)
     {
         return(Redirect("./login?referer=analytics"));
     }
     if (Request.Query.ContainsKey("ID"))
     {
         try
         {
             Festival = Festival.Read(int.Parse(Request.Query["ID"]));
         }
         catch
         {
             return(NotFound());
         }
     }
     else
     {
         Festival = new Festival();
     }
     return(Page());
 }
        public List <Festival> GetFestivals()
        {
            List <Festival> result = new List <Festival>();

            System.Data.DataTableReader query;
            if (Scope.Read(HttpContext.Session.GetInt32("UserID").Value)?.HasFlag(UserScopes.SeeAllData) ?? false)
            {
                query = Sql.Query($"SELECT * FROM Festival;");
            }
            else
            {
                query = Sql.Query($"SELECT * FROM Festival WHERE OwnerID = {HttpContext.Session.GetInt32("UserID").Value};");
            }
            if (query.HasRows)
            {
                while (query.Read())
                {
                    result.Add(Festival.Read(query.GetInt32(0)));
                }
                return(result);
            }
            Message = "Geen Festivals gevonden.";
            return(result);
        }