public async Task <IActionResult> SerialNoCheckAndHistory() { string serialNo = HttpContext.Request.Query["serialNo"].ToString(); SerialNoCheckAndHistoryResponse response = _iRepairAndMaintenanceService.SerialNoCheckAndHistory(serialNo); return(Ok(response)); }
public SerialNoCheckAndHistoryResponse SerialNoCheckAndHistory(string serialNo) { SerialNoCheckAndHistoryResponse response = new SerialNoCheckAndHistoryResponse(); List <sp_SSH_GetSkuBySerial> machineDetail = _dbContext.sp_SSH_GetSkuBySerial.FromSqlInterpolated($"EXECUTE dbo.sp_SSH_GetSkuBySerial {serialNo}").ToList(); if (machineDetail != null && machineDetail.Count > 0) { bool machineControl = context.TblSshMachinesRepository.Get().Where(a => a.SerialNo == serialNo).Any(); if (machineControl == true) { var machineHistory = _dbContext.vSSHMachineHistory.Where(q => q.SerialNo == serialNo).ToList(); response.MachineHistory = machineHistory; response.MachineDetail = machineDetail; response.isModal = false; response.isSuccess = true; return(response); } else { response.MachineHistory = null; response.isModal = true; response.isSuccess = true; response.MachineDetail = null; return(response); } } else { response.MachineHistory = null; response.ErrorMessage = "Seri numarası kontrol ediniz!"; response.isSuccess = false; response.isModal = false; response.MachineDetail = null; return(response); } }