示例#1
0
		public async Task<User> Login(string username, string password)
		{
			var user = new User 
			{
				Username = username, 
				Password = password 
			};
			await client.GetTable<User>().InsertAsync(user);
			return user;
		}
示例#2
0
		public async Task<User> Register(User user)
		{
			await Sleep();

			return user;
		}
示例#3
0
		public async Task LoadData()
		{
			var users = client.GetTable<User>();
			var friends = client.GetTable<Friend>();

			var me = new User
			{
				Username = "******",
				Password = "******"
			};
			var friend = new User
			{
				Username = "******",
				Password = "******"
			};

			await users.InsertAsync(me);
			await users.InsertAsync(friend);

			await friends.InsertAsync(new Friend { MyId = me.Id, Username = friend.Username });
			await friends.InsertAsync(new Friend { MyId = friend.Id, Username = me.Username });

			var conversations = client.GetTable<Conversation>();
			var messages = client.GetTable<Message>();

			var conversation = new Conversation
			{
				MyId = me.Id,
				UserId = friend.Id,
				Username = friend.Username,
				LastMessage = "HEY!"
			};

			await conversations.InsertAsync(conversation);
			await messages.InsertAsync(new Message 
			{ 
				ConversationId = conversation.Id, 
				ToId = me.Id,
				UserId = friend.Id, 
				Username = friend.Username, Text = "What's up?", 
				Date = DateTime.Now.AddSeconds(-60),
			});
			await messages.InsertAsync(new Message 
			{ 
				ConversationId = conversation.Id, 
				ToId = friend.Id,
				UserId = me.Id, 
				Username = me.Username, Text = "Not much", 
				Date = DateTime.Now.AddSeconds(-30),
			});
			await messages.InsertAsync(new Message 
			{ 
				ConversationId = conversation.Id, 
				ToId = me.Id,
				UserId = friend.Id, 
				Username = friend.Username, Text = "HEY!", 
				Date = DateTime.Now,
			});
		}
示例#4
0
		public async Task<User> Register(User user)
		{
			await client.GetTable<User>().InsertAsync(user);
			return user;
		}