public MetricDTO GetMetrics(int metric_Id) { MetricDTO matric = new MetricDTO(); IList <TagDTO> tag_dto = _tagRespository.SelectAllBy_IsDisable(false); try { Tbl_Metric_DTO tbl_metric_dto = (from metric in _dbcontext.tblMetrics.AsEnumerable() where metric.Id == metric_Id select new Tbl_Metric_DTO { tbl_Metric = metric, tag_dto = SelectAll_Tag_By_TagIDs(Source_Json.Convert_Json_To_Source_Json(metric.Source).Tags), element_dto = SelectAll_Element_By_ElementIDs(Source_Json.Convert_Json_To_Source_Json(metric.Source).Points) }).Single(); matric = MetricDTO.Convert_Table_To_DTO(tbl_metric_dto); } catch (Exception ex) { throw ex; } return(matric); }
public IList <MetricDTO> GetMetrics() { List <MetricDTO> matrics = new List <MetricDTO>(); IList <TagDTO> tag_dto = _tagRespository.SelectAllBy_IsDisable(false); try { IEnumerable <Tbl_Metric_DTO> tbl_metric_dtos = (from metric in _dbcontext.tblMetrics.AsEnumerable() select new Tbl_Metric_DTO { tbl_Metric = metric, tag_dto = SelectAll_Tag_By_TagIDs(Source_Json.Convert_Json_To_Source_Json(metric.Source).Tags) }).ToList(); matrics.AddRange(MetricDTO.Convert_List_Table_To_List_DTO(tbl_metric_dtos)); matrics.AddRange(_pre_define_matric); } catch (Exception ex) { throw ex; } return(matrics); }