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); }
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); }