when convert utcnow
to local time, it shows error like
"LINQ to Entities does not recognize the method 'System.DateTime ToLocalTime()' method, and this method cannot be translated into a store expression."
I am using SQL Server 2014 and not mango db. It will work when I use the function UTCtoLocal
outside the query. But I need to use it within the linq query to speed up the execution. There is any other way to do that.
group new
{
Id = ord.Id,
ShipmentInfoId = shipment.Id,
PartnerName = partner.Name,
PartNumber = ordItem.SellerProductID,
OrderNumber = ord.UniqueOrderID,
PartCount = shipment.PartCount,
DeliveryDate = ord.DeliveryDate,
IsSentInvoice = shipment.IsSentInvoice != null ? shipment.IsSentInvoice : false,
IsSentASN = shipment.IsSentASN != null ? shipment.IsSentASN : false,
ShippingPartCount = 0,
IsManualEntered = ord.IsManualEntered,
LastGeneratedInvoiceDate = shipment.LastGeneratedInvoiceDate.Value.UtcToLocal(),
LastGeneratedASNDate = shipment.LastGeneratedASNDate.Value.UtcToLocal(),