private void AssertDistrict(District province, District savedProvince)
 {
     Assert.AreEqual(province.DistrictName, savedProvince.DistrictName);
     Assert.AreEqual(province.Province, savedProvince.Province);
     Assert.AreEqual(province._Status, EntityStatus.Active);
 }
 public DistrictDTO Map(District district)
 {
     if (district == null) return null;
     return Mapper.Map<District, DistrictDTO>(district);
 }
 public void Save(DistrictViewModel dvm)
 {
     District dist = new District(dvm.Id)
     {
      
      Province=_provinceRepository.GetById(dvm.ProvinceId),
      DistrictName=dvm.DistrictName
     };
     _districtRepository.Save(dist);
 }
 DistrictViewModel Map(District dist)
 {
     return new DistrictViewModel 
     {
         DistrictName = dist.DistrictName,
         
         ProvinceId = _provinceRepository.GetById(dist.Province.Id).Id,
         ProvinceName = _provinceRepository.GetById(dist.Province.Id).Name,
         Id = dist.Id,
         isActive = dist._Status == EntityStatus.Active ? true : false
     };
 }
Esempio n. 5
0
 protected Guid AddDistrict(Guid Province, string DistrictName)
 {
     District district = new District(Guid.NewGuid())
     {
         Province = _provinceRepository.GetById(Province),
         DistrictName = DistrictName
     };
     district._SetStatus(EntityStatus.Active);
     return _districtRepository.Save(district);
 }