Exemplo n.º 1
0
        public List <CityHistory> GetCityHistoryList(List <City> items)
        {
            var list = new List <CityHistory>();
            var user = _repositoryUser.Get().FirstOrDefault(x => x.DisplayOrder == 1);

            if (user == null)
            {
                return(new List <CityHistory>());
            }


            foreach (var item in items)
            {
                var itemHistory = new CityHistory
                {
                    Id               = Guid.NewGuid(),
                    CityId           = item.Id,
                    CityCode         = item.CityCode,
                    CountryId        = item.Country.Id,
                    DisplayOrder     = item.DisplayOrder,
                    IsApproved       = item.IsApproved,
                    CreateDate       = DateTime.Now,
                    CreatedBy        = user.Id,
                    VersionNo        = 1,
                    RestoreVersionNo = 0,
                    IsDeleted        = false
                };
                list.Add(itemHistory);
            }

            return(list);
        }
Exemplo n.º 2
0
 public void AddCityHistory(CityHistory itemHistory)
 {
     _repositoryCityHistory.Add(itemHistory);
     _repositoryCityHistory.SaveChanges();
 }