public void Test_Map_VipDemand() { var entity = new VipDemand { Id = 2, SerialNumber = "4433", TownId = 4, FinishTime = DateTime.Parse("2016-7-6"), DemandLevel = DemandLevel.LevelA, NetworkType = NetworkType.With2G3G4G4GPlus, MarketTheme = MarketTheme.HappyNewYear, VipState = VipState.NetworkOptimization }; var dto = new VipDemandDto(); Mapper.Map(entity, dto); dto.SerialNumber.ShouldBe("4433"); dto.TownId.ShouldBe(4); dto.IsInfoComplete.ShouldBe(false); dto.IsFinished.ShouldBeTrue(); dto.DemandLevelDescription.ShouldBe("A级"); dto.NetworkTypeDescription.ShouldBe("2G/3G/4G/4G+"); dto.MarketThemeDescription.ShouldBe("岁末年初"); dto.CurrentStateDescription.ShouldBe("优化调整"); }
public async Task <VipProcessDto> ConstructProcess(VipDemandDto dto, string userName) { return(await _repository .ConstructProcess <IVipDemandRepository, IVipProcessRepository, VipDemand, VipDemandDto, VipProcess, VipProcessDto>(_processRepository, dto, userName)); }
public void Test_Map_Reverse_VipDemandDto() { var dto = new VipDemandDto { SerialNumber = "4433", TownId = 5, IsFinished = true, DemandLevelDescription = "A级" }; var entity = new VipDemand { Id = 5, TownId = 3 }; Mapper.Map(dto, entity); entity.SerialNumber.ShouldBe("4433"); entity.Id.ShouldBe(5); entity.DemandLevel.ShouldBe(DemandLevel.LevelA); ((DateTime)entity.FinishTime).Date.ShouldBe(DateTime.Today); }
public void Test_VipDemand_FromDto() { var info = new VipDemandDto { DemandLevelDescription = DemandLevel.LevelA.GetEnumDescription(), ProjectName = "abcdef", ContactPerson = "12345", NetworkTypeDescription = NetworkType.With2G3G.GetEnumDescription(), MarketThemeDescription = MarketTheme.CollegeSpring.GetEnumDescription(), CurrentStateDescription = VipState.Conclusion.GetEnumDescription(), PlanDate = new DateTime(2016, 2, 2) }; var item = info.MapTo <VipDemand>(); Assert.AreEqual(item.DemandLevel, DemandLevel.LevelA); Assert.AreEqual(item.ProjectName, "abcdef"); Assert.AreEqual(item.ContactPerson, "12345"); Assert.AreEqual(item.NetworkType, NetworkType.With2G3G); Assert.AreEqual(item.MarketTheme, MarketTheme.CollegeSpring); Assert.AreEqual(item.VipState, VipState.Conclusion); Assert.IsNotNull(item.FinishTime); Assert.AreEqual(((DateTime)item.FinishTime).Date, DateTime.Today); Assert.AreEqual(item.PlanDate, new DateTime(2016, 2, 2)); }
public VipDemand Match(VipDemandDto stat) { return(FirstOrDefault(x => x.SerialNumber == stat.SerialNumber)); }
public async Task<VipProcessDto> Post(VipDemandDto dto) { return await _service.ConstructProcess(dto, User.Identity.Name); }
public async Task<int> Put(VipDemandDto dto) { return await _service.UpdateAsync(dto); }
public int Post(VipDemandDto dto) { return _service.Dump(dto); }
public async Task <int> UpdateAsync(VipDemandDto dto) { dto.TownId = _townRepository.QueryTown(dto.District, dto.Town)?.Id ?? 1; return(await _repository.UpdateOne <IVipDemandRepository, VipDemand, VipDemandDto>(dto)); }
public async Task <int> Post(VipDemandDto dto) { return(await _service.UpdateAsync(dto)); }
public void Test_Map_Reverse_VipDemandDto() { var dto = new VipDemandDto { SerialNumber = "4433", TownId = 5, IsFinished = true, DemandLevelDescription = "A级" }; var entity = new VipDemand { Id = 5, TownId = 3 }; Mapper.Map(dto, entity); entity.SerialNumber.ShouldBe("4433"); entity.Id.ShouldBe(5); entity.DemandLevel.ShouldBe(DemandLevel.LevelA); ((DateTime)entity.FinishTime).Date.ShouldBe(DateTime.Today); }
public void Test_Map_VipDemand() { var entity = new VipDemand { Id = 2, SerialNumber = "4433", TownId = 4, FinishTime = DateTime.Parse("2016-7-6"), DemandLevel = DemandLevel.LevelA, NetworkType = NetworkType.With2G3G4G4GPlus, MarketTheme = MarketTheme.HappyNewYear, VipState = VipState.NetworkOptimization }; var dto = new VipDemandDto(); Mapper.Map(entity, dto); dto.SerialNumber.ShouldBe("4433"); dto.TownId.ShouldBe(4); dto.IsInfoComplete.ShouldBe(false); dto.IsFinished.ShouldBeTrue(); dto.DemandLevelDescription.ShouldBe("A级"); dto.NetworkTypeDescription.ShouldBe("2G/3G/4G/4G+"); dto.MarketThemeDescription.ShouldBe("岁末年初"); dto.CurrentStateDescription.ShouldBe("优化调整"); }
public void Test_VipDemand_FromDto() { var info = new VipDemandDto { DemandLevelDescription = DemandLevel.LevelA.GetEnumDescription(), ProjectName = "abcdef", ContactPerson = "12345", NetworkTypeDescription = NetworkType.With2G3G.GetEnumDescription(), MarketThemeDescription = MarketTheme.CollegeSpring.GetEnumDescription(), CurrentStateDescription = VipState.Conclusion.GetEnumDescription(), PlanDate = new DateTime(2016, 2, 2) }; var item = info.MapTo<VipDemand>(); Assert.AreEqual(item.DemandLevel,DemandLevel.LevelA); Assert.AreEqual(item.ProjectName, "abcdef"); Assert.AreEqual(item.ContactPerson, "12345"); Assert.AreEqual(item.NetworkType, NetworkType.With2G3G); Assert.AreEqual(item.MarketTheme,MarketTheme.CollegeSpring); Assert.AreEqual(item.VipState,VipState.Conclusion); Assert.IsNotNull(item.FinishTime); Assert.AreEqual(((DateTime)item.FinishTime).Date, DateTime.Today); Assert.AreEqual(item.PlanDate, new DateTime(2016, 2, 2)); }
public int Post(VipDemandDto dto) { return(_service.Dump(dto)); }
public async Task <VipProcessDto> Post(VipDemandDto dto) { return(await _service.ConstructProcess(dto, User.Identity.Name)); }
public int Dump(VipDemandDto dto) { return (_repository .DumpItem <IVipDemandRepository, VipDemand, VipDemandDto>(dto, _townRepository)); }