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); }
public void AddDistrictHistory(DistrictHistory itemHistory) { _repositoryDistrictHistory.Add(itemHistory); _repositoryDistrictHistory.SaveChanges(); }