fix ordinamento items
This commit is contained in:
@@ -150,7 +150,7 @@ namespace StockMan.Data.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lista Item Flux (ALL!)
|
||||
/// Aggiunta famiglia di item
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ItemFamilyAdd(ItemFamilyModel newRec)
|
||||
@@ -185,6 +185,43 @@ namespace StockMan.Data.Controllers
|
||||
}
|
||||
return fatto;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// aggiunta item
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ItemAdd(ItemModel newRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
List<ItemModel> dbResult = new List<ItemModel>();
|
||||
using (StockManContext localDbCtx = new StockManContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currRec = localDbCtx
|
||||
.DbSetItem
|
||||
.Where(x => x.Id == newRec.Id)
|
||||
.FirstOrDefault();
|
||||
if (currRec != null)
|
||||
{
|
||||
fatto = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
localDbCtx
|
||||
.DbSetItem
|
||||
.Add(newRec);
|
||||
}
|
||||
await localDbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante ItemAdd{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -266,7 +303,7 @@ namespace StockMan.Data.Controllers
|
||||
{
|
||||
var risultato = localDbCtx
|
||||
.DbSetItem
|
||||
.Where(x => ((x.Id.ToString()==searchVal)) || (x.CodInt.Contains(searchVal)) || (x.Descr.Contains(searchVal) || (x.CurrValue.ToString().Contains(searchVal))))
|
||||
.Where(x => ((x.Id.ToString()==searchVal)) || (x.CodInt.Contains(searchVal)) || (x.CodExt.Contains(searchVal)) || (x.Descr.Contains(searchVal) || (x.CurrValue.ToString().Contains(searchVal))))
|
||||
.ToList();
|
||||
|
||||
if (risultato != null)
|
||||
|
||||
Reference in New Issue
Block a user