Beispiel #1
0
        private async Task SaveProfileInformation()
        {
            var groupResult = await groupTable.Where(g => g.Groupname == "DefaultGroup").ToListAsync();
            ReceiverGroup defaultGroup = groupResult.FirstOrDefault();

            string firstname = FirstnameTb.Text;
            string lastname = LastnameTb.Text;
           
            var currentUser = new Receiver
            {
                Id = Guid.NewGuid().ToString(),
                Firstname = firstname,
                Lastname = lastname,
                UserId = user.UserId,
                ReceiverGroup = new ReceiverGroup { Groupname = defaultGroup.Groupname, Id = defaultGroup.Id }
            };

            await receiverTable.InsertAsync(currentUser);
        }
Beispiel #2
0
        private async Task UpdateUserInformation(Receiver existingUser)
        {
            var currentFirstname = existingUser.Firstname;
            var currentLastname = existingUser.Lastname;

            var newFirstname = FirstnameTb.Text;
            var newLastname = LastnameTb.Text;

            if (currentFirstname != FirstnameTb.Text || currentLastname != LastnameTb.Text)
            {
                var currentUser = new Receiver
                {
                    Id = existingUser.Id,
                    Firstname = newFirstname,
                    Lastname = newLastname,
                    UserId = existingUser.UserId,
                    ReceiverGroup = existingUser.ReceiverGroup
                };
                await receiverTable.UpdateAsync(currentUser);
            }
        }