Hello friends,
Long time no see
There is something I want to talk to you experts. In my Blazor Server application, I am uploading an excel and updating records like this.
After updating successfully, when I navigate to another razer page and display data, I am encountering the data unchanged. What is wrong with UpdateRange?
Long time no see
C#:
public async Task UpdateReportAsync(List<OrderDetail> reports)
{
_db.UpdateRange(reports);
await _db.SaveChangesAsync();
}
After updating successfully, when I navigate to another razer page and display data, I am encountering the data unchanged. What is wrong with UpdateRange?
C#:
public async Task<IEnumerable<Order?>> GetAllOrders(ClaimsPrincipal user)
{
if (user.IsInRole("Administrators"))
{
var result = await _db.Orders
.Include(d => d.OrderDetails.Where(od => od.IsActive == 1))
.ThenInclude(v => v.Vendor)
.Include(c => c.Customer)
.OrderByDescending(s => s.Id)
.ToListAsync();
return result;
}
return await _db.Orders
.Where(u => u.DoneBy == user.Identity.Name)
.Include(d => d.OrderDetails.Where(od => od.IsActive == 1))
.ThenInclude(v => v.Vendor)
.Include(c => c.Customer)
.OrderByDescending(s => s.Id)
.ToListAsync();
}