You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In reference to my post I would like to suggest a solution:
IList items = _dataSource.OrderItems.Where(r => r.OrderID == objItem.OrderID).ToList();
objItem.OrderLine = items.Select(r => r.OrderLine).DefaultIfEmpty(0).Max() + 1;
public async Task UpdateOrderItemAsync(OrderItem orderItem)
{
if (orderItem.OrderLine > 0)
{
_dataSource.Entry(orderItem).State = EntityState.Modified;
}
else
{
orderItem.OrderLine = _dataSource.OrderItems.Where(r => r.OrderID == orderItem.OrderID).Select(r => r.OrderLine).DefaultIfEmpty(0).Max() + 1;
// TODO:
//orderItem.CreateOn = DateTime.UtcNow;
_dataSource.Entry(orderItem).State = EntityState.Added;
}
// TODO:
//orderItem.LastModifiedOn = DateTime.UtcNow;
//orderItem.SearchTerms = orderItem.BuildSearchTerms();
return await _dataSource.SaveChangesAsync();
}
orderItem.OrderLine = .... not working
The text was updated successfully, but these errors were encountered: