Aggiunti metodi per inserimento nuova sessione +
delete sessione
This commit is contained in:
@@ -36,6 +36,7 @@ namespace MP.Data.Controllers
|
||||
dbResult = dbCtx
|
||||
.DbInveSess
|
||||
.Where(x => x.DtEnd == null)
|
||||
.Include(m=>m.AnagMagNav)
|
||||
.AsNoTracking()
|
||||
.OrderByDescending(x => x.DtStart)
|
||||
.ToList();
|
||||
@@ -57,6 +58,7 @@ namespace MP.Data.Controllers
|
||||
dbResult = dbCtx
|
||||
.DbInveSess
|
||||
.Where(x => x.DtStart >= FromDate && x.DtStart <= ToDate && x.DtEnd != null)
|
||||
.Include(m=>m.AnagMagNav)
|
||||
.AsNoTracking()
|
||||
.OrderByDescending(x => x.DtStart)
|
||||
.ToList();
|
||||
@@ -88,6 +90,23 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco Magazzini
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<AnagMagModel> ElencoMagazzini()
|
||||
{
|
||||
List<AnagMagModel> dbResult = new List<AnagMagModel>();
|
||||
using (var dbCtx = new MoonPro_InveContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbAnagMag
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.MagID)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco operatori
|
||||
@@ -120,6 +139,55 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// insert di un record sessione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> InsertNewSessione(InventorySessionModel newRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonPro_InveContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
dbCtx
|
||||
.DbInveSess
|
||||
.Add(newRec);
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante InsertNewSessione{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// delete sessione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> deleteSessione(InventorySessionModel record)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonPro_InveContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
dbCtx
|
||||
.DbInveSess
|
||||
.Remove(record);
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante deleteSessione{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
Reference in New Issue
Block a user