public object GetAttendenceByID([FromBody] TAttendenceModal.GetAttendenceByIdReq req) { BLL_Attendence bllAttendence = new BLL_Attendence(); TAttendenceModal.GetAttendenceByIdResp resp = bllAttendence.GetAttendenceById(req); return(resp); }
internal TAttendenceModal.GetAttendenceByIdResp GetAttendenceById(TAttendenceModal.GetAttendenceByIdReq req) { TAttendenceModal.GetAttendenceByIdResp rsp = new TAttendenceModal.GetAttendenceByIdResp(); rsp.apiError = new APIErrors(); rsp.apiError = ApiError_defs.err_Invalid_Request; List <ITAttendence> liAttendence = _storage.GetAttendenceById(req.nEntityId, req.day, req.month, req.year); List <TAttendenceModal.AttendenceInfo> liAttendenceInfo = new List <TAttendenceModal.AttendenceInfo>(); ITEntity entity; ITBus bus; if (liAttendence != null && liAttendence.Count > 0) { foreach (ITAttendence iAtt in liAttendence) { TAttendenceModal.AttendenceInfo objAttendence = new TAttendenceModal.AttendenceInfo(); entity = _storage.GetEntityByID(iAtt.nEntityFK); bus = _storage.GetBusById(iAtt.nBusFK); objAttendence.n = iAtt.n; objAttendence.nEntityId = iAtt.nEntityFK; objAttendence.sFname = entity.sFname; objAttendence.sMname = entity.sMname; objAttendence.sLname = entity.sLname; objAttendence.nBusFK = iAtt.nBusFK; objAttendence.sRegNo = bus.sRegNo; objAttendence.rInLat = iAtt.rInLat; objAttendence.rInLong = iAtt.rInLong; objAttendence.rOutLat = iAtt.rOutLat; objAttendence.rOutLong = iAtt.rOutLong; objAttendence.dStampIn = iAtt.dStampIn; objAttendence.dStampOut = iAtt.dStampOut; liAttendenceInfo.Add(objAttendence); } rsp.liAttendence = liAttendenceInfo; rsp.apiError = ApiError_defs.ok; } return(rsp); }