public void Update_BreweryMember_Gets_Added()
 {
     var newBrewery = new Brewery
     {
         Name = "NewBrewery" + DateTime.Now.Ticks,
         Description = "Somehting",
         Type = "HomeBrewery",
         OriginId = 5,
         Address = "Something",
         Latitude = 60.3894,
         Longitude = 5.33,
         Website = "Something",
         HeaderImage = "Something",
         Avatar = "Something",
     };
     _breweryRepository.Add(newBrewery);
     var brewery = _breweryRepository.GetSingle(newBrewery.BreweryId);
     var breweryMember = new BreweryMember { MemberUsername = "******"};
     brewery.Members.Add(breweryMember);
     _breweryRepository.Update(brewery);
     var updated = _breweryRepository.GetSingle(brewery.BreweryId);
     Assert.True(updated.Members.Any(s => s.MemberUsername == brewery.Members.FirstOrDefault().MemberUsername && s.BreweryId == brewery.Members.FirstOrDefault().BreweryId));
 }
 public async Task AddMemberAsync(BreweryMember breweryMember)
 {
     using (var context = DapperHelper.GetOpenConnection())
     {
         using (var transaction = context.BeginTransaction())
         {
             await context.ExecuteAsync("INSERT BreweryMembers(BreweryId,MemberUsername,Role,Confirmed) VALUES(@BreweryId,@MemberUsername,@Role,@Confirmed);",
         breweryMember, transaction);
         }
     }
 }
 public async Task AddMemberAsync(BreweryMember breweryMember)
 {
     using (var context = new MicrobrewitContext())
     {
         context.BreweryMembers.Add(breweryMember);
         await context.SaveChangesAsync();
     }
 }
 public async Task UpdateMemberAsync(BreweryMember breweryMember)
 {
     using (var context = DapperHelper.GetOpenConnection())
     {
         using (var transaction = context.BeginTransaction())
         {
             await context.ExecuteAsync(
                 "UPDATE BreweryMembers set Role = @Role, Confirmed = @Confirmed WHERE BreweryId = @BreweryId and MemberUsername = @MemberUsername;",
                 breweryMember, transaction);
         }
     }
 }
 public async Task UpdateMemberAsync(BreweryMember breweryMember)
 {
     using (var context = new MicrobrewitContext())
     {
         context.Entry(breweryMember).State = EntityState.Modified;
         await context.SaveChangesAsync();
     }
 }