i have tried till my head hurts and have been reading so much my eyes now bleed.
i have a controller, and i want to get one set of data for the order and one list for the order items.
i have created a order class and a order items class, and trying to get it so that the order will have a list of order items but it is crashing my brain i dont know if im on the right path or not or if im missing something i just dont get it.
here is my code
public ActionResult finaliseQuote(string quoteid)
{
ViewData["quoteid"] = quoteid;
// populate our class with data about our quote so far
var orders = (from q in quote.All()
where q.quoteid == quoteid
select q).SingleOrDefault();
//IList<quoteParts> orderItemsList = new quoteParts(orderitems); (this not work)
quoteParts myparts = new quoteParts((from qi in quoteItem.All()
where qi.quote_id == quoteid
select qi).SingleOrDefault()); // compiles but this is not a list ?????
return View();
}
then my 2 classes:
public class quoteInfo
{
public IList<quoteParts> items { get; set; }
public DateTime datecreated { get; set; }
public double totalcost { get; set; }
public string quotesid { get; set; }
public quoteInfo(quote myquote)
{
items = new List<quoteParts>();
}
}
public class quoteParts
{
public string itemsid { get; set; }
public bool isextra { get; set; }
public string qty { get; set; }
public string mx { get; set; }
public string my { get; set; }
public string prodid { get; set; }
public quoteParts(quoteItem item)
{
itemsid = item.itemid;
isextra = item.isextra;
qty = item.qty;
mx = item.measureX.ToString();
my = item.measureY.ToString();
prodid = item.prodid;
}
}
i am hoping that i can create a view and then reference quoteInfo and also loop through quoteParts in another section of the page.
i know to some this may seem like i am being lazy but im not i learn when i get it right once it works it is then that i understand, right now i want to do OOP etc but seem to be hitting wall after wall.
many thanks