public int Register(UserModel model) { int userid = 0; if (model.Password == model.ConfirmPassword) { ICommandPassword password = new PasswordGenerator(); //User user = AutoMapper.Mapper.Map<UserModel, User>(model); User user = new User(); user.Login = model.Login; user.Name = model.Name; user.Password = model.Password; user.CreationDate = DateTime.Now; using (var c = new EntityContext()) { UsersOperation operation = new UsersOperation(); ICryptography crypto = new PasswordManager(); user.Password = crypto.Encrypt(model.Password); userid = operation.AddAndGetId(user, c); } } return(userid); }
public void UpdateUser(User model) { using (var c = new EntityContext()) { UsersOperation operation = new UsersOperation(); operation.Update(model, c); } }
public User GetById(int id) { User user; using (var c = new EntityContext()) { UsersOperation operation = new UsersOperation(); user = operation.Get(id, c); } return(user); }
public User Get(UserModel model) { User usermodel = new User(); using (var c = new EntityContext()) { UsersOperation operation = new UsersOperation(); usermodel = operation.GetByLogin(model.Login, c); } return(usermodel); }
private void Users_AcoOperation(object sender, CollectionOperationEventArgs <User> e) { UsersOperation?.Invoke(this, new CollectionOperationEventArgs <IUser>(e.Item, e.Operation)); NotifyPropertyChanged(nameof(Users)); }