Ejemplo n.º 1
0
        public void Save(CountryViewModel country)
        {
            Country coutr = new Country(country.id)
            {
                Name = country.Name,
                Code = country.Code,
                Currency = country.Currency
            };
            _countryRepository.Save(coutr);

        }
Ejemplo n.º 2
0
 CountryViewModel Map(Country country)
 {
     return new CountryViewModel
     {
         id = country.Id,
         Name = country.Name,
         Currency = country.Currency,
         Code = country.Code,
         isActive = country._Status == EntityStatus.Active ? true : false
     };
 }
Ejemplo n.º 3
0
 protected ValidationResultInfo Validate(Country country)
 {
     return _countryRepository.Validate(country);
 }
Ejemplo n.º 4
0
        protected Country Map(CountryImport countryImport)
        {
            var exists = Queryable.FirstOrDefault(_context.tblCountry, p => p.Code == countryImport.Code);
            Guid id = exists != null ? exists.id : Guid.NewGuid();
            
            var country = new Country(id);
            country.Name = countryImport.Name;
            country.Code = countryImport.Code;
            country.Currency = "";

            return country;

        }
Ejemplo n.º 5
0
 public CountryDTO Map(Country country)
 {
     if (country == null) return null;
     return Mapper.Map<Country, CountryDTO>(country);
 }
Ejemplo n.º 6
0
 public static Country Map(this tblCountry country)
 {
     Country cntry = new Country(country.id)
     {
         Name = country.Name,
          Code=country.Code,
          Currency=country.Currency
     };
     cntry._SetStatus((EntityStatus)country.IM_Status);
     cntry._SetDateCreated(country.IM_DateCreated);
     cntry._SetDateLastUpdated(country.IM_DateLastUpdated);
     return cntry;
 }
Ejemplo n.º 7
0
 public bool CheckCountryIsUsed(Country country, EntityStatus intendedStatus)
 {
     if (intendedStatus == EntityStatus.Inactive)
     {
         if (_ctx.tblRegion.Any(n => n.Country == country.Id && n.IM_Status == (int)EntityStatus.Active))
             return true;
     }
     else if (intendedStatus == EntityStatus.Deleted)
     {
         if (_ctx.tblRegion.Any(n => n.Country == country.Id &&
             (n.IM_Status == (int)EntityStatus.Active || n.IM_Status == (int)EntityStatus.Inactive)))
             return true;
     }
     return false;
 }
Ejemplo n.º 8
0
        protected Guid AddCountry(string name, string currency, string code)
        {
            Country country = new Country(Guid.NewGuid(), DateTime.Now, DateTime.Now, EntityStatus.Active)
            {
                Name = name,
                Currency=currency,
                Code=code
            };

            return _countryRepository.Save(country);
        }
Ejemplo n.º 9
0
 private void AssertCountry(Country country, Country savedCountry)
 {
     Assert.AreEqual(country.Code,savedCountry.Code);
     Assert.AreEqual(country.Name,savedCountry.Name);
     Assert.AreEqual(country.Currency,savedCountry.Currency);
     Assert.AreEqual(country._Status,EntityStatus.Active);
 }