Exemplo n.º 1
0
 public void CreateMemberShip(int memberId)
 {
     var member = GetMemberById(memberId);
     if (member == null) return;
     using (SqlServerMembersDb Db = new SqlServerMembersDb(ConnectionString))
     {
         var membership = new MemberShip();
         Db.Memberships.Add(membership);
         Db.SaveChanges();
         Db.Members.Attach(member);
         member.Membership = membership;
         Db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void SetMemberLocation(int memberId, decimal latitude, decimal longitude)
 {
     var member = GetMemberById(memberId);
     if (member == null) return;
     using (SqlServerMembersDb Db = new SqlServerMembersDb(ConnectionString))
     {
         Db.Members.Attach(member);
         member.LastLongitude = longitude;
         member.LastLatitude = latitude;
         Db.Entry(member).Property("LastLongitude").IsModified = true;
         Db.Entry(member).Property("LastLatitude").IsModified = true;
         Db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public int StoreMember(Member member)
 {
     using (SqlServerMembersDb Db = new SqlServerMembersDb(ConnectionString))
     {
         Db.Members.Add(member);
         Db.SaveChanges();
     }
     return member.MemberId;
 }