public bool LoginUser(Guid clientId, string loginName, Room room) { // check for duplicates var duplicateUser = UserRepository.Instance.Query(u => u.Name.Equals(loginName)).FirstOrDefault(); if (duplicateUser != null) { return(false); } var user = new User { ClientKey = clientId, Name = loginName }; UserRepository.Instance.Add(user); room.Users.Add(user); RoomRepository.Instance.Update(room); UserRepository.Instance.Update(user); return(true); }
/// <summary> /// Create a new User object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="clientKey">Initial value of the ClientKey property.</param> public static User CreateUser(global::System.Int64 id, global::System.String name, global::System.Guid clientKey) { User user = new User(); user.Id = id; user.Name = name; user.ClientKey = clientKey; return user; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(User user) { base.AddObject("Users", user); }