Exemple #1
0
        /// <summary>
        /// Add new login
        /// </summary>
        /// <param name="login">user's login</param>
        /// <returns>ok</returns>
        public async Task AddLogin(Logins login)
        {
            Logins existed = Logins.FirstOrDefault(x => x.Login == login.Login);

            if (existed == null)
            {
                var role = Roles.LastOrDefault(x => x.Id > 0);
                if (role != null)
                {
                    login.RoleId = role.Id;
                }

                await Logins.AddAsync(login);
                await SaveChangesAsync();
            }
        }