public override async Task UpdateAsync(Kullanici entity, UserHelper userHelper) { await Kontrol(entity); var kullanici = await GetByIdAsync(entity.Id); if (entity.Sifre.IsNull()) { entity.Sifre = kullanici.Sifre; } if (entity.Token.IsNull()) { entity.Token = kullanici.Token; } if (userHelper.IsNull()) { userHelper = new UserHelper(); } Task[] tasks = new Task[2]; if (entity.Kisi.IsNull()) { tasks[0] = Task.CompletedTask; } else { tasks[0] = _kisiServis.UpdateAsync(entity.Kisi, userHelper); } tasks[1] = base.UpdateAsync(entity, userHelper); await Task.WhenAll(tasks); }
public override async Task UpdateAsync(Oyuncu entity, UserHelper userHelper) { //using (TransactionScope scope = new TransactionScope()) //{ Task[] tasks = new Task[4]; if (entity.Kisi.ProfilFotoUrl == null) { if (entity.OyuncuResimleri != null && entity.OyuncuResimleri.Count > 0) { entity.Kisi.ProfilFotoUrl = entity.OyuncuResimleri[0].DosyaYolu; } } tasks[0] = _kisiServis.UpdateAsync(entity.Kisi, userHelper); tasks[1] = base.UpdateAsync(entity, userHelper); if (entity.OyuncuResimleri == null) { entity.OyuncuResimleri = new List <OyuncuResim>(); } foreach (var item in entity.OyuncuResimleri.Where(i => i.OyuncuId == 0)) { item.OyuncuId = entity.Kisi.Id; } tasks[2] = _OyuncuResimServis.SaveListAsync(entity.OyuncuResimleri, userHelper); if (entity.OyuncuVideolari == null) { entity.OyuncuVideolari = new List <OyuncuVideo>(); } foreach (var item in entity.OyuncuVideolari.Where(i => i.OyuncuId == 0)) { item.OyuncuId = entity.Kisi.Id; } tasks[3] = _OyuncuVideoServis.SaveListAsync(entity.OyuncuVideolari, userHelper); await Task.WhenAll(tasks); //scope.Complete(); //} }