Esempio n. 1
0
        public IActionResult Get()
        {
            using EntityGateway db = new EntityGateway();
            int i = db.GetTable <Subject>().Count();

            Subject[] subjects = new Subject[]
            {
                new Subject {
                    Name = $"Subject {i}"
                },
                new Subject {
                    Name = $"Subject {i+1}"
                },
                new Subject {
                    Name = $"Subject {i+2}"
                },
                new Subject {
                    Name = $"Subject {i+3}"
                },
                new Subject {
                    Name = $"Subject {i+4}"
                },
            };
            db.AddRange(subjects);
            IEnumerable <Moderator> moderators = db.GetTable <Moderator>().ToList();

            if (!moderators.Any())
            {
                db.AddOrUpdate(new Moderator
                {
                    Birthday            = DateTime.Now,
                    Citizenship         = "DEFAULT",
                    DocumentNumber      = "DEFAULT DEFAULT",
                    DocumentType        = DocumentType.Passport,
                    Login               = "******",
                    Name                = "DEFAULT",
                    Passhash            = "admin",
                    PensionInsurance    = "DEFAULT",
                    Phone               = "DEFAULT",
                    RegistrationAddress = "DEFAULT DEFAULT DEFAULT"
                });
            }
            return(Ok(new { status = "ok", shit = "lol + 5 subjects", admins = moderators }));
        }