public static User Map(AuthorViewModel viewModel) { User user = new User(); user.Id = viewModel.Id; user.Email = viewModel.Email; user.FirstName = viewModel.FirstName; user.LastName = viewModel.LastName; return user; }
public static AuthorViewModel Map(User user) { AuthorViewModel viewModel = new AuthorViewModel(); viewModel.Id = user.Id; viewModel.Email = user.Email; viewModel.FirstName = user.FirstName; viewModel.LastName = user.LastName; return viewModel; }
public void Register(User user, string password) { if (!dataContext.UserStorage.Exists(user.Email)) { user.LastAccessDate = DateTime.Now; user.RegistrationDate = DateTime.Now; dataContext.UserStorage.Add(user); RegisterNewUser(user, password); } }
public static User Map(RegistrationViewModel viewModel) { User user = new User(); user.Email = viewModel.Email; user.FirstName = viewModel.FirstName; user.LastName = viewModel.LastName; user.University = viewModel.University; user.BirthDate = DateMapper.Map(viewModel.BirthDate); user.PhotoFileName = viewModel.PhotoFileName; return user; }
public void Update(User user) { Entities.Database.ExecuteSqlCommand( UpdateUserQuery, user.Email, user.FirstName, user.LastName, user.University, user.BirthDate, user.LastAccessDate, user.PhotoFileName, user.Id); }
private void RegisterNewUser(User user, string password) { try { roleManager.AddUserToRole(user.Email, UserRole); accountManager.CreateAccount(user.Email, password); } catch (SecurityCreateUserException) { dataContext.UserStorage.Remove(user.Email); throw; } }
public static User Map(UserViewModel viewModel) { User user = new User(); user.Id = viewModel.Id; user.Email = viewModel.Email; user.FirstName = viewModel.FirstName; user.LastName = viewModel.LastName; user.BirthDate = DateMapper.Map(viewModel.BirthDate); user.PhotoFileName = viewModel.PhotoFile != null ? viewModel.PhotoFile.FileName : viewModel.PhotoFileName; user.University = viewModel.University; return user; }
public static UserViewModel Map(User user) { UserViewModel viewModel = new UserViewModel(); viewModel.Id = user.Id; viewModel.Email = user.Email; viewModel.FirstName = user.FirstName; viewModel.LastName = user.LastName; viewModel.University = user.University; viewModel.BirthDate = DateMapper.Map(user.BirthDate); viewModel.PhotoFileName = user.PhotoFileName; if (user.Disciplines != null) { viewModel.Disciplines = user.Disciplines.Select(DisciplineMapper.Map); } return viewModel; }
public void Update(User user) { Account.Update(user); }
public void Register(User user, string password) { Account.Register(user, password); }
public void Add(User user) { Add(user, Entities.Users); }
//TODO: move to separate class public void Update(User user) { user.LastAccessDate = DateTime.Now; dataContext.UserStorage.Update(user); }
private void CreateUser(string userFile) { string userInfo = File.ReadAllText(userFile); var user = new User(); user.Email = GetInfoField(userInfo, "email"); user.FirstName = GetInfoField(userInfo, "first_name"); user.LastName = GetInfoField(userInfo, "last_name"); user.University = GetInfoField(userInfo, "university"); user.BirthDate = DateTime.Parse(GetInfoField(userInfo, "date")); user.PhotoFileName = "0.jpg"; string passwrod = GetInfoField(userInfo, "password"); service.Register(user, passwrod); string[] disciplines = GetInfoField(userInfo, "disciplines").Split(','); service.Subscribe(user.Id, GetDisciplines(disciplines)); if (!Regex.IsMatch(userFile, "\\d")) { roleManager.AddUserToRole(user.Email, "Admin"); } }