public ActionResult CustomerWashingInsert(MusteriDTO musteri, MusteriYikamaDTO yikama) { AracDTO arac = new AracDTO(); arac.MarkaID = musteri.MarkaID; arac.ModelID = musteri.ModelID; arac.Plaka = musteri.Plaka; int aracID; aracID = _aracService.GetCar(arac.Plaka); if (aracID == 0) { aracID = _aracService.Insert(arac); } musteri.HizmetTuru = "Yıkama"; if (musteri.Aciklama == null) { musteri.Aciklama = "Açıklama Girilmedi."; } if (musteri.Tutar == null) { musteri.Tutar = 0; } int musteriID = _musteriService.CustomerInsert(musteri, aracID); _musteriService.CustomerWashingInsert(yikama, musteriID); return(RedirectToAction("CustomerList", "Customer")); }
public CustomerService(UnitofWork uow) { _uow = uow; _musteriRepo = _uow.GetRepository <Musteri>(); _parkRepo = _uow.GetRepository <MusteriPark>(); _yikamaRepo = _uow.GetRepository <MusteriYikama>(); _aracRepo = _uow.GetRepository <Arac>(); _markaRepo = _uow.GetRepository <AracMarka>(); _modelRepo = _uow.GetRepository <AracModel>(); _musteriDTO = new MusteriDTO(); _parkDTO = new MusteriParkDTO(); _yikamaDTO = new MusteriYikamaDTO(); }
public void CustomerWashingInsert(MusteriYikamaDTO yikama, int musteriID) { try { var entity = AutoMapper.Mapper.DynamicMap <MusteriYikama>(yikama); entity.MusteriID = musteriID; _yikamaRepo.Insert(entity); _uow.SaveChanges(); } catch (Exception ex) { throw new Exception(ex.Message); } }