Как решить ошибку типа «Не удается неявно преобразовать тип»? - PullRequest
0 голосов
/ 17 мая 2018

Код:

   public IEnumerable<InvoiceStringData> GetInvoiceByID(string orderID)
            {
                 var orderId = Convert.ToInt32(orderID);
                 ResponseDetails jsonRes = new ResponseDetails();

            List<string> campaignidByProdid = new List<string>();
            Productlevelcharges prodlevel = new Productlevelcharges();
            List<Productlevelcharges> lstprodlevel = new 
List<Productlevelcharges>();
            List<OrderVM> lstorvm = new List<OrderVM>();
            List<ProductMaster> lstpmvm = new List<ProductMaster>();
            List<OrderDetailsVM> lstodvm = new List<OrderDetailsVM>();
            List<ProductVariant> lstpvvm = new List<ProductVariant>();
            List<CampaignProductMapper> lstcmvm = new 
List<CampaignProductMapper>();
            List<CampaignVm> lstcm = new List<CampaignVm>();
            List<InvoiceStringData> Bill = new List<InvoiceStringData>();
            InvoiceStringData InvoiceStringData = new InvoiceStringData();

            var orderChargId = _context.Orderlevelcharges.Where(a => a.OrderId == orderId).Select(a => a.OrderChargeId).FirstOrDefault();
            var orderCharge = orderChargId.ToString();

            var lst = CalculateUnitPrice(orderCharge, orderID);

            var result = (from v in lst
                          group v by new
                          {
                              v.InvoiceDate,
                              v.InvoiceNo,
                              v.NetAmount,
                              v.TotalAmount,
                              v.SaveAmount
                          } into order
                          select new 
                          {


                              invoiceDate = order.Key.InvoiceDate,
                              netAmount = order.Key.NetAmount,
                              totalAmount = order.Key.TotalAmount,
                              saveAmount = order.Key.SaveAmount,
                              // productMasterlst=order
                              _invoice = new
                              {
                                  product = order.Select(o => new { 
o.productName, o.UnitPrice, o.Quantity, o.UnitOfMeasure, o.hsnCode, 
o.Weight, o.Tax1Sgst, o.Tax2Cgst, o.Tax3Igst })
                          }


                          }).ToList();

            return result;

       }

ошибка: CS0266 не может неявно преобразовать тип 'System.Collections.Generic.List <> product> _invoice >>' до 'System.Collections.Generic.IEnumerable'. Существует явное преобразование (вам не хватает приведения?) Payment.API D: \ Consumer Billing \ MRU 15-05-18 10.47 \ MRU Current \ src \ Services \ Payment \ Payment.API \ BAL \ Repository \ InvoiceRepo.cs 131 Активный

...