예제 #1
0
 public async Task AddMemberDetails(Member item)
 {
     try
     {
         var aMember = _db.Set<data.Member>().Create();
         aMember.LastName = item.LastName;
         aMember.FirstName = item.Firstname;
         aMember.BirthDate = item.BirthDate ?? item.BirthDate;
         aMember.Gender = item.Gender;
         aMember.Phone = item.Phone;
         aMember.Email = item.Email;
         aMember.AspNetUserId = item.AspNetUserId;
         aMember.DateCreated = DateTime.Now;
         aMember.DateModified = DateTime.Now;
         _db.Members.Add(aMember);
         await _db.SaveChangesAsync();
         item.Id = aMember.Id;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         throw;
     }
 }
예제 #2
0
 public async Task<int> AddEventRegistrations(Member aMember, Order order, Cart item)
 {
     var eventReg = _db.Set<data.EventRegistration>().Create();
     if (item.EventId != null) eventReg.EventId = item.EventId.Value;
     eventReg.MemberId = aMember.Id;
     eventReg.OrderId = order.OrderId;
     eventReg.CreationDate = DateTime.Now;
     eventReg.ModifiedDate = DateTime.Now;
     _db.EventRegistrations.Add(eventReg);
     await _db.SaveChangesAsync();
     return eventReg.ID;
 }
예제 #3
0
 private async Task<Member> GetMemberInfoFromAspNetUserId(string currentUserId)
 {
     var entity = await _db.Members.FirstOrDefaultAsync(c => c.AspNetUserId == currentUserId);
     if (entity != null)
     {
         var aMember = new Member()
         {
             Id = entity.Id,
             LastName = entity.LastName,
             Firstname = entity.FirstName,
             Gender = entity.Gender
         };
         return aMember;
     }
     return null;
 }