//补录 public void collectionHealthEveryRegisterInfo(HealthEveryCollectionViewModel healthEveryAddViewModel) { var insertInfo = _IMapper.Map <HealthEveryCollectionViewModel, Health_Info>(healthEveryAddViewModel); healthRepository.Add(insertInfo); healthRepository.SaveChanges();//添加每日健康信息 //var isexist = healthRepository.collectionexisthealthInfo(healthEveryAddViewModel); //if (!isexist) //{ // healthRepository.Add(insertInfo); // healthRepository.SaveChanges();//添加每日健康信息 // //var insertHealth = healthRepository.getByidNumber(insertInfo.IdNumber);//查询插入的 mapper中加密 // //var facultystaff = facultystaffInfoRepository.getByidNumber(insertInfo.IdNumber);//查询白绑定的基础信息 // //var studentInfo = studentInfoRepository.getByidNumber(insertInfo.IdNumber); // //if (facultystaff != null)//不复制键值 // //{ // // insertInfo.facultystaff_InfoId = facultystaff.id; // // healthRepository.Update(insertInfo); // //} // //if (studentInfo != null) // //{ // // insertInfo.Student_InfoId = studentInfo.id; // // healthRepository.Update(insertInfo); // //} // //healthRepository.SaveChanges(); //} }
// GET: HealthInfo/Details/5 public ActionResult <BaseViewModel> AddHealthRegisterCollection(HealthEveryCollectionViewModel healthViewModel) { BaseViewModel baseViewModel = new BaseViewModel(); healthService.collectionHealthEveryRegisterInfo(healthViewModel); baseViewModel.Message = "补录成功"; baseViewModel.ResponseCode = 200; return(Ok(baseViewModel)); }
public bool collectionexisthealthInfo(HealthEveryCollectionViewModel healthEveryAddViewModel) { var temp = DbSet.FirstOrDefault(a => a.IdNumber == Dtol.Helper.MD5.Md5Hash(healthEveryAddViewModel.IdNumber) && a.CheckType == healthEveryAddViewModel.CheckType && a.Createdate.Value.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd") ); if (temp == null) { return(false); } else { return(true); } }