예제 #1
0
        public void CreateNewAcc(AccType acctype, string name, string lastname)
        {
            if (name == null || lastname == null)
            {
                throw new ArgumentNullException("Parametrs can't be null");
            }

            if (name.Length <= 1 || lastname.Length <= 1)
            {
                throw new ArgumentNullException("Parametrs can't be empty or less then 1");
            }

            storage.Add(acctype.ToString(), name, lastname);
        }
예제 #2
0
        public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);

            // Add custom user claims here
            try
            {
                userIdentity.AddClaim(new Claim("User", User));
                userIdentity.AddClaim(new Claim("AccType", AccType.ToString()));
                userIdentity.AddClaim(new Claim("FullName", FullName));
                userIdentity.AddClaim(new Claim("SchoolName", SchoolName));
            }
            catch (System.Exception)
            {
            }
            return(userIdentity);
        }
 public string Get(AccType accType)
 {
     return(accType.ToString());
 }