public StaffOtherInfo GetStaffOtherInfoByStaffId(long staffId) { StaffOtherInfo staffOtherInfo = new StaffOtherInfo(); try { if (staffId > 0) { staffOtherInfo = _staffService.GetStaffOtherInfoByStaffId(staffId); if (staffOtherInfo != null) { if (!string.IsNullOrEmpty(staffOtherInfo.DegreeIds)) { string[] degreeIds = staffOtherInfo.DegreeIds.Split('|'); staffOtherInfo.DegreeIdList = Array.ConvertAll(degreeIds, int.Parse).ToList(); } if (!string.IsNullOrEmpty(staffOtherInfo.SubjectIds)) { string[] subjectIds = staffOtherInfo.SubjectIds.Split('|'); staffOtherInfo.SubjectIdList = Array.ConvertAll(subjectIds, int.Parse).ToList(); } } } } catch (Exception ex) { throw new Exception(ex.Message); } return(staffOtherInfo); }
public StaffOtherInfo InsertUpdateStaffOtherData([FromBody] StaffOtherInfo staffOtherInfo) { try { if (ModelState.IsValid) { staffOtherInfo.UpdateDate = DateTime.Now; staffOtherInfo.DegreeIds = staffOtherInfo.DegreeIdList.Count > 0 ? string.Join("|", staffOtherInfo.DegreeIdList) : null; staffOtherInfo.SubjectIds = staffOtherInfo.SubjectIdList.Count > 0 ? string.Join("|", staffOtherInfo.SubjectIdList) : null; staffOtherInfo = _staffService.InsertUpdateStaffOtherInfo(staffOtherInfo); } } catch (Exception ex) { throw new Exception(ex.Message); } return(staffOtherInfo); }
public StaffOtherInfo InsertUpdateStaffOtherInfo(StaffOtherInfo staffOtherInfo) { return(_staffRepo.InsertUpdateStaffOtherInfo(staffOtherInfo)); }