public AracDTO GetById(int id) { using (AracRepository aracRepo = new AracRepository()) { try { var entity = aracRepo.GetById(id); var aracdto = new AracDTO(); aracdto.airbag = entity.airbag; aracdto.aracID = entity.aracID; aracdto.bagajHacmi = entity.bagajHacmi; aracdto.ehliyetYasi = entity.ehliyetYasi; aracdto.gunlukFiyat = entity.gunlukFiyat; aracdto.gunlukKm = entity.gunlukKm; aracdto.KM = entity.KM; aracdto.koltukSayisi = entity.koltukSayisi; aracdto.marka = entity.marka; aracdto.model = entity.model; aracdto.sirketAdi = entity.Sirket.sirketAdi; aracdto.sirketID = entity.sirketID; aracdto.yasSiniri = entity.yasSiniri; return(aracdto); } catch (Exception ex) { throw new Exception(ex.Message); } } }
public List <AracDTO> GetAllCars(int sirketId) { using (AracRepository aracRepository = new AracRepository()) { List <AracDTO> Araclar = new List <AracDTO>(); var model = aracRepository.Get(); foreach (var entity in model.ToList()) { if (entity.sirketID == sirketId) { var aracdto = new AracDTO(); aracdto.airbag = entity.airbag; aracdto.aracID = entity.aracID; aracdto.bagajHacmi = entity.bagajHacmi; aracdto.ehliyetYasi = entity.ehliyetYasi; aracdto.gunlukFiyat = entity.gunlukFiyat; aracdto.gunlukKm = entity.gunlukKm; aracdto.KM = entity.KM; aracdto.koltukSayisi = entity.koltukSayisi; aracdto.marka = entity.marka; aracdto.model = entity.model; aracdto.sirketAdi = entity.Sirket.sirketAdi; aracdto.sirketID = entity.sirketID; aracdto.yasSiniri = entity.yasSiniri; Araclar.Add(aracdto); } } return(Araclar); } }
public void Delete(int id) { using (AracRepository aracRepo = new AracRepository()) { try { aracRepo.Delete(id); } catch (Exception ex) { throw new Exception(ex.Message); } } }
public void Update(Arac model) { using (AracRepository aracRepo = new AracRepository()) { try { aracRepo.Update(model); } catch (Exception ex) { throw; } } }
public Arac AracPlakaSec(string plaka) { try { Arac responseEntitiy = null; using (var repo = new AracRepository()) { responseEntitiy = repo.PlakaSec(plaka); } return(responseEntitiy); } catch (Exception ex) { throw new Exception("AracBusiness:AracRepository:Seçme Hatası", ex); } }
public Arac AracIdSec(int AracId) { try { Arac responseEntitiy = null; using (var repo = new AracRepository()) { responseEntitiy = repo.IdSec(AracId); } return(responseEntitiy); } catch (Exception ex) { throw new Exception("AracBusiness:AracRepository:Seçme Hatası", ex); } }
public bool AracGuncelle(Arac arac) { try { bool isSuccess; using (var repo = new AracRepository()) { isSuccess = repo.Update(arac); } return(isSuccess); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Business:AracBusiness::AracGuncelle::Hata Oluştu.", ex); } }
public bool DeleteAracById(int ID) { try { bool isSuccess; using (var repo = new AracRepository()) { isSuccess = repo.DeletedById(ID); } return(isSuccess); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("BusinessLogic:AracBusiness::AracCustomer::Error occured.", ex); } }
public bool UpdateArac(Arac entity) { try { bool isSuccess; using (var repo = new AracRepository()) { isSuccess = repo.Update(entity); } return(isSuccess); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("BusinessLogic:AracBusiness::UpdateArac::Error occured.", ex); } }
public bool AracSilById(int aracID) { try { bool isSuccess; using (var repo = new AracRepository()) { isSuccess = repo.DeletedById(aracID); } return(isSuccess); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Business:AracBusiness::AracSilById::Hata Oluştu.", ex); } }
public Arac AracIdSil(int AracId) { try { using (var repo = new AracRepository()) { if (repo.IdSil(AracId)) { return(repo.IdSec(AracId)); } } return(null); } catch (Exception ex) { throw new Exception("AracBusiness:AracRepository:Silme Hatası", ex); } }
public Arac AracGuncelle(Arac entity) { try { using (var repo = new AracRepository()) { if (repo.Guncelle(entity)) { return(entity); } } return(null); } catch (Exception ex) { throw new Exception("AracBusiness:AracRepository:Güncelleme Hatası", ex); } }
public Arac AracKirala(Arac entity) { try { using (var repo = new AracRepository()) { //var entity = repo.IdSec(arac.AracID); if (repo.Kirala(entity)) { return(entity); } } return(null); } catch (Exception ex) { throw new Exception("AracBusiness:AracRepository:Kiralama Hatası", ex); } }
public List <AracDTO> GetForUsers(DateTime baslangic, DateTime bitis, int sirketId) { using (AracRepository aracRepository = new AracRepository()) { List <AracDTO> Araclar = new List <AracDTO>(); var model = aracRepository.Get().Where(x => x.sirketID == sirketId);// tüm araçları aldık var kiralikaracRepo = new KiralikAracRepository(); var kiralikmodels = kiralikaracRepo.Get().Where(x => x.Arac.sirketID == sirketId); foreach (var entity in model) { var test = kiralikmodels.Where (x => x.aracID == entity.aracID && (x.bitisTarihi > baslangic || x.bitisTarihi == baslangic) && x.baslangicTarihi < bitis).ToList(); if (test.Count > 0) { continue; } else { var aracdto = new AracDTO(); aracdto.airbag = entity.airbag; aracdto.aracID = entity.aracID; aracdto.bagajHacmi = entity.bagajHacmi; aracdto.ehliyetYasi = entity.ehliyetYasi; aracdto.gunlukFiyat = entity.gunlukFiyat; aracdto.gunlukKm = entity.gunlukKm; aracdto.KM = entity.KM; aracdto.koltukSayisi = entity.koltukSayisi; aracdto.marka = entity.marka; aracdto.model = entity.model; aracdto.sirketAdi = entity.Sirket.sirketAdi; aracdto.sirketID = entity.sirketID; aracdto.yasSiniri = entity.yasSiniri; Araclar.Add(aracdto); } } return(Araclar); } }
public Arac AracSecById(int aracID) { try { Arac secilenArac; using (var repo = new AracRepository()) { secilenArac = repo.SelectedById(aracID); if (secilenArac == null) { throw new NullReferenceException("Girilen aracID bulunamadi!"); } } return(secilenArac); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Business:AracBusiness::AracSecById::Hata Oluştu.", ex); } }
public List <Arac> SelectAllArac() { var responseEntities = new List <Arac>(); try { using (var repo = new AracRepository()) { foreach (var entity in repo.SelectAll()) { responseEntities.Add(entity); } } return(responseEntities); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("BusinessLogic:AracBusiness::SelectAllCArac::Error occured.", ex); } }
public Arac SelectAracById(int Id) { try { Arac responseEntitiy; using (var repo = new AracRepository()) { responseEntitiy = repo.SelectedById(Id); if (responseEntitiy == null) { throw new NullReferenceException("Sirket doesnt exists!"); } } return(responseEntitiy); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("BusinessLogic:AracBusiness::SelectAracById::Error occured.", ex); } }
public List <Arac> SelectAllArac() { var aracListesi = new List <Arac>(); try { using (var repo = new AracRepository()) { foreach (var arac in repo.SelectAll()) { aracListesi.Add(arac); } } return(aracListesi); } catch (Exception ex) { LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true); throw new Exception("Business:AracBusiness::SelectAllArac::Hata Oluştu.", ex); } }
public bool Add(Arac model) { using (AracRepository aracRepo = new AracRepository()) { try { if (aracRepo.Add(model)) { return(true); } else { return(false); } } catch (Exception ex) { throw new Exception(ex.Message); } } }
public List <Arac> AracHepsiniSec() { var responseEntities = new List <Arac>(); try { using (var repo = new AracRepository()) { foreach (var entity in repo.HepsiniSec()) { responseEntities.Add(entity); } } if (responseEntities == null) { return(responseEntities); } return(responseEntities); } catch (Exception ex) { throw new Exception("AracBusiness:AracRepository:Hepsini Seçme Hatası", ex); } }
public UnitOfWork(AracContext context) { _aracContext = context; AracRepository = new AracRepository(_aracContext); }