public string Register(string tideToken, string publicKey) { var key = GetPublicKey(publicKey); if (!ValidateTideToken(tideToken, key)) { return(null); } var claims = ExtractClaims(tideToken, key); var vuid = claims.First(c => c.Type == "vuid").Value; _context.Add(new VendorUser { PublicKey = publicKey, Vuid = vuid }); _context.SaveChanges(); return(GenerateVendorToken(vuid)); }
public static void EnsureSeedData(this VendorDbContext context) { if (context.IsMigrationsApplied()) { if (!context.Users.Any()) { context.Users.Add( new User { UserName = "******", Email = "-", LockoutEnabled = false, Image = null, RegisterDate = DateTime.Now, Update = DateTime.Now }); context.SaveChanges(); } if (!context.Languages.Any()) { context.Languages.AddRange( new Language { Name = "Русский", Alias = "ru-RU", IsDefault = true, Update = DateTime.Now, UserUpDateId = 1 }, new Language { Name = "English", Alias = "en-US", IsDefault = false, Update = DateTime.Now, UserUpDateId = 1 }); context.SaveChanges(); } if (!context.Products.Any()) { context.Products.AddRange( new Product { // Name = "DetailOne", // Description = "The first detail", // Update = DateTime.Now, UserUpdateId = 1 }, new Product { // Name = "DetailTwo", // Description = "The second detail", // Update = DateTime.Now, UserUpdateId = 1 }); context.SaveChanges(); } } }