Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static bool GenerateBasicCompanyKey(UserInfo companyInfo, DateTime? keyExpires = null)
- {
- BasicAuthKey bak = (from s in ctx.BasicAuthKey where s.CompanyID == companyInfo.ID select s).FirstOrDefault();
- if (bak == null)
- {
- bak = new BasicAuthKey();
- bak.CompanyID = companyInfo.ID;
- bak.KeyRegistered = DateTime.Now;
- bak.KeyExpires = keyExpires;
- bak.UserInfo = companyInfo;
- bak.BasicKey = GenerateKey(companyInfo);
- ctx.BasicAuthKey.Add(bak);
- ctx.SaveChanges();
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement