Example #1
0
        public UserModel AddUser(UserModel model)
        {
            var script = string.Format("INSERT INTO [User](UserName,Password) VALUES('{0}','{1}');SELECT @@IDENTITY;", model.UserName, model.Password);

            model.Id = _dbConnector.GetIntegerValue(new SqlCommand(script));

            DataStorageService.AddUserRole(model);

            DataStorageService.AddUserRoleGroup(model);

            return(model);
        }
Example #2
0
        public UserModel GetUserByAuthenticate(string authentication)
        {
            var script = string.Format("SELECT [User].* FROM [User] INNER JOIN [UserAuthentication] ON [User].Id = [UserAuthentication].UserId WHERE [UserAuthentication].Authentication = '{0}'", authentication);

            var ds = _dbConnector.ExecuteCommandsDataSet(new SqlCommand(script));

            var models = PopulateUser(ds);

            var model = models.Count == 1 ? models.First() : null;

            DataStorageService.AddUserRole(model);

            DataStorageService.AddUserRoleGroup(model);

            return(model);
        }