public MembershipUser CreateUser(string email, string password, string pathAvatar)
        {
            MembershipUser membershipUser = GetUser(email, false);

            if (membershipUser != null)
            {
                return null;
            }

            var user = new DalUser()
            {
                Name = email,
                Password = Crypto.HashPassword(password),
                PathAvatar = pathAvatar
                //http://msdn.microsoft.com/ru-ru/library/system.web.helpers.crypto(v=vs.111).aspx
            };

            var role = RoleRepository.GetAllRoles().FirstOrDefault(r => r.Name == "User");
            if (role != null)
            {
                user.RoleId = role.Id;
            }

            UserRepository.Create(user);
            membershipUser = GetUser(email, false);
            return membershipUser;
        }
 public void Create(DalUser e)
 {
     var user = new User()
     {
         Email = e.Name,
         RoleId = 2,
         CreationDate = DateTime.Now,
         Password = e.Password,
         Avatar = e.PathAvatar
     };
     _context.Set<User>().Add(user);
     _context.SaveChanges();
 }
 public void Update(DalUser entity)
 {
     throw new NotImplementedException();
 }