Home how to solve error like "Cannot implicitly convert type"?
Reply: 0

how to solve error like "Cannot implicitly convert type"?

user2909
1#
user2909 Published in August 15, 2018, 5:37 am

Code:

   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;

       }

error: CS0266 Cannot implicitly convert type 'System.Collections.Generic.List<> product> _invoice>>' to 'System.Collections.Generic.IEnumerable'. An explicit conversion exists (are you missing a cast?) Payment.API D:\Consumer Billing\MRU 15-05-18 10.47\MRU Current\src\Services\Payment\Payment.API\BAL\Repository\InvoiceRepo.cs 131 Active

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.290791 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO