Example #1
0
        void SeedApiUsers()
        {
            try
            {
                var user = new ApiUser()
                {
                    Name   = "My Cool App",
                    AppId  = "SSB3aWxsIG1ha2UgbXkgQVBJIHNlY3VyZQ==",
                    Secret = "VGhpcyBDb3Vyc2UgSXMgQXdlc29tZQ=="
                };

                _ctx.ApiUsers.Add(user);

                var token = new AuthToken()
                {
                    Token      = "1234567890",
                    Expiration = DateTime.Today.AddDays(365),
                    ApiUser    = user
                };

                _ctx.AuthTokens.Add(token);

                _ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
 public bool SaveAll()
 {
     return(_ctx.SaveChanges() > 0);
 }