예제 #1
0
        public List <DistrictHistory> GetDistrictHistoryList(List <District> items)
        {
            var list = new List <DistrictHistory>();
            var user = _repositoryUser.Get().FirstOrDefault(x => x.DisplayOrder == 1);

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


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

            return(list);
        }
예제 #2
0
 public void AddDistrictHistory(DistrictHistory itemHistory)
 {
     _repositoryDistrictHistory.Add(itemHistory);
     _repositoryDistrictHistory.SaveChanges();
 }