public static User ToEntity(UserDTO user) { var entity = new User(); entity.Username = user.Username; entity.Password = PasswordUtil.Encrypt(user.Password); entity.Active = user.Active; entity.Id = user.Id; return(entity); }