public void Init(string email, IRepository repository)
 {
     if (!string.IsNullOrEmpty(email))
     {
         User = repository.GetUser(email);
     }
 }
 public bool UpdateUser(User instance)
 {
     User cache = Db.User.Where(p => p.ID == instance.ID).FirstOrDefault();
     if (cache != null)
     {
         cache.Birthdate = instance.Birthdate;
         cache.AvatarPath = instance.AvatarPath;
         cache.Email = instance.Email;
         Db.User.Context.SubmitChanges();
         return true;
     }
     return false;
 }
        public bool CreateUser(User instance)
        {
            if (instance.ID == 0)
            {
                instance.Password = User.CreatePassHash(instance.Password);
                instance.AddedDate = DateTime.Now;
                instance.ActivatedLink = User.GetActivateUrl();
                Db.User.InsertOnSubmit(instance);
                Db.User.Context.SubmitChanges();
                return true;
            }

            return false;
        }