public List <ScrapStructureWorkFlowDetail> GetScrapWorkflowDetails(ScrapWorkflowDetailsPayload reqPayload) { try { List <ScrapStructureWorkFlowDetail> result = new List <ScrapStructureWorkFlowDetail> (); var sureplusDecl = _context.Query <ScrapStructureWorkFlowDetail> ().FromSqlRaw("select ss.Id, ss.from_project_id as FromProjectId, ss.proj_struct_id as ProjStructId,ss.status as Status, ss.role_id as RoleId , (select name from structures s2 where id in (select structure_id from project_structure ps where id =ss.proj_struct_id )) as StructureName,(select struct_code from project_structure ps where id =ss.proj_struct_id) as StructCode ,(select structure_attributes_val from project_structure ps where id =ss.proj_struct_id) as StructureAttValue ,(select count(*) from component c2 where proj_struct_id =ps2.id) as CurrentComponentsCount, ps2.components_count as RequiredComponenentCount,p.name as FromProjectName, p.proj_code as ProjectCode, ss.created_at as CreatedDate,ps2.struct_code as StructureCode from scrap_structure ss inner join project_structure ps2 on ps2.id = ss.proj_struct_id inner join project p on p.id = ps2.project_id order by ss.created_at,ss.updated_at desc").ToList(); result = _mapper.Map <List <ScrapStructureWorkFlowDetail> > (sureplusDecl); return(result); } catch (Exception ex) { throw ex; } }
public IActionResult GetWorkFlowScrapDetails([FromQuery] ScrapWorkflowDetailsPayload payload) { try { var response = _scrapStructureService.GetScrapWorkflowDetails(payload); return(Ok(response)); } catch (Exception e) { Util.LogError(e); return(StatusCode(StatusCodes.Status500InternalServerError, new ErrorClass() { code = StatusCodes.Status500InternalServerError.ToString(), message = "Something went wrong" })); } }
public List <ScrapStructureWorkFlowDetail> GetScrapWorkflowDetails(ScrapWorkflowDetailsPayload payload) { List <ScrapStructureWorkFlowDetail> scrapStructureDetails = _scrapStructureRepository.GetScrapWorkflowDetails(payload); return(scrapStructureDetails); }