From c07709cd68cd06173bad3f596ed7ba94edd5545d Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Thu, 6 Apr 2023 15:11:05 +0200 Subject: [PATCH] fix controllo variabili passate metodo listvalues --- .../Controllers/WebDoorCreatorController.cs | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs index 47bd642..2ea120b 100644 --- a/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs +++ b/WebDoorCreator.Data/Controllers/WebDoorCreatorController.cs @@ -1,5 +1,6 @@ using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Internal; using Microsoft.Extensions.Configuration; using NLog; using System.Data; @@ -507,12 +508,32 @@ namespace WebDoorCreator.Data.Controllers { try { - // extracting entire set - dbResult = localDbCtx - .DbSetValues - .Where(x => (x.TableName == tableName || x.TableName.Contains(tableName)) && (x.FieldName == fieldName)) - .OrderBy(x => x.Ordinal) - .ToList(); + if (tableName != "*" && fieldName != "*") + { + + // extracting entire set + dbResult = localDbCtx + .DbSetValues + .Where(x => (x.TableName == tableName) && (x.FieldName == fieldName)) + .OrderBy(x => x.Ordinal) + .ToList(); + } + else if(tableName == "*" && fieldName != "*") + { + dbResult = localDbCtx + .DbSetValues + .Where(x => (x.FieldName == fieldName)) + .OrderBy(x => x.Ordinal) + .ToList(); + } + else if (tableName != "*" && fieldName == "*") + { + dbResult = localDbCtx + .DbSetValues + .Where(x => (x.TableName == tableName)) + .OrderBy(x => x.Ordinal) + .ToList(); + } } catch (Exception exc) { @@ -554,7 +575,7 @@ namespace WebDoorCreator.Data.Controllers fatto = true; - + fatto = true; } catch (Exception exc)