Ramco Ramco

Ramco Ramco

  • 440
  • 3.4k
  • 529.6k

Error - List<InvoiceLines> does not contain a definition for Id

Jul 8 2021 8:36 AM

Hi

Error -> List<InvoiceLines> does not contain a definition for Id

public int Add(InvoiceHeader objInvoice)
        {
            int i;
            using (SqlConnection con = new SqlConnection(cs))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("sp_Invoice", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@No", objInvoice.No);
                cmd.Parameters.AddWithValue("@No", objInvoice.DocumentDate);
                cmd.Parameters.AddWithValue("@No", objInvoice.Po_No);
                cmd.Parameters.AddWithValue("@No", objInvoice.Po_Date);
                cmd.Parameters.AddWithValue("@No", objInvoice._InvoiceLines.Id);
                cmd.Parameters.AddWithValue("@Action", "C");
                i = cmd.ExecuteNonQuery();
            }
            return i;
        }

**************************************

public class InvoiceHeader
    {
        public InvoiceHeader()
        {
        }

        [Key]
        [Display(Name = "Document No")]
        public string No { get; set; }

        public string DocumentDate { get; set; }
        [Display(Name = "Custoemr Id")]
        public Customer CustomerId { get; set; }

        public string Po_No { get; set; }

        public DateTime Po_Date { get; set; }

        public List<InvoiceLines> _InvoiceLines { get; set; }
        public List<Items> _Items { get; set; }
    }

public class InvoiceLines
    {
        public string DocumentNo { get; set; }
        public Items Id { get; set; }
        public decimal Quantity { get; set; }
        public Nullable<decimal> price { get; set; }
        public Nullable<decimal> GrossAmount { get; set; }
        public Nullable<decimal> NetAmount { get; set; }
    }

Thanks


Answers (3)