//修改 学生信息 public BaseViewModel updateStudentInfo(StudentMiddle student) { BaseViewModel baseView = new BaseViewModel(); var originModel = _studentInfoRepository.getbyID(student.id); var info = _IMapper.Map <StudentMiddle, Student_Info>(student, originModel); _studentInfoRepository.Update(info); var userInfo = _userInfoRepository.GetByIdnumber(info.IdNumber); if (userInfo == null) { _userInfoRepository.AddDefault(info.IdNumber); } int i = _studentInfoRepository.SaveChanges(); if (i > 0) { baseView.ResponseCode = 0; baseView.Message = "修改成功"; } else { baseView.ResponseCode = 1; baseView.Message = "修改失败"; } return(baseView); }
public ActionResult <BaseViewModel> updateStudentInfo(StudentMiddle student) { BaseViewModel viewModel = _studentService.updateStudentInfo(student); return(viewModel); }