예제 #1
0
 private User TranslateUserEntityToUser(UserEntity userEntity)
 {
     User user = new User()
     {
         UserId = userEntity.UserId,
         Email = userEntity.Email,
         Name = userEntity.Name,
     };
     return user;
 }
예제 #2
0
 /// <summary>
 /// Create a new UserEntity object.
 /// </summary>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="email">Initial value of the Email property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 public static UserEntity CreateUserEntity(global::System.Int32 userId, global::System.String email, global::System.String name)
 {
     UserEntity userEntity = new UserEntity();
     userEntity.UserId = userId;
     userEntity.Email = email;
     userEntity.Name = name;
     return userEntity;
 }
예제 #3
0
        public int CreateNewUser(User user)
        {
            using (DobbermanEntities context = new DobbermanEntities())
            {
                // find out if user already exists by its email
                UserEntity validateUser = (from p
                                             in context.Users
                                         where p.Email == user.Email
                                         select p).FirstOrDefault();
                if (!(validateUser == null)) return validateUser.UserId;

                UserEntity userEntity = new UserEntity()
                {
                    Email = user.Email,
                    Name = user.Name,
                };
                context.AddToUsers(userEntity);
                context.SaveChanges();
                return userEntity.UserId;
            }
        }
예제 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUsers(UserEntity userEntity)
 {
     base.AddObject("Users", userEntity);
 }