Exemplo n.º 1
0
        public async Task CreateMemberAsync(MemberDto member, Phone phone, Address address)
        {
            try
            {
                var dbPhone = await CreatePhone(phone);
                var addressId = await CreateAddress(address);
                var user = await DbContext.GetUserByEmailAsync(member.Email);
                var dbMember = new Member
                {
                    DateOfBirth = member.DoB,
                    Height = member.Height,
                    Sex = member.Sex,
                    Weight = member.Weight,
                    AddressId = addressId,
                    Address = address,
                    Phone = new List<Phone> { dbPhone },
                    User = user,
                    UserId = user?.Id,
                };

                await DbContext.CreateMemberAsync(dbMember);
            }
            catch (DbEntityValidationException ex)
            {
                
            }
            
        }
Exemplo n.º 2
0
 public async Task CreateMemberAsync(Member member)
 {
     Members.AddOrUpdate(member);
     await SaveChangesAsync();
 }