【发布时间】:2012-08-31 14:02:13
【问题描述】:
我有课
public class Offer
{
public Int32 OfferId { get; set; }
public string OfferTitle { get; set; }
public string OfferDescription { get; set; }
}
和另一个班级
public class OfferLocationViewModel
{
public Offer Offer { get; set; }
public Int32 InTotalBranch { get; set; }
public Int32 BusinessTotalLocation { get; set; }
}
现在在我的控制器中,我有以下内容
public ActionResult PresentOffers(Guid id)
{
DateTime todaysDate=Utility.getCurrentDateTime();
var rOffers=(from k in dc.GetPresentOffers(id,todaysDate)
select new OfferLocationViewModel()
{
Offer. //I dont get anything here..
}).ToList();
return PartialView();
}
现在问题出在我的控制器上,我无法访问“Offer”类的任何属性! 我想,因为我正在创建一个新的 OfferLocationViewModel() 并且它具有“Offer”类型的属性,所以我将能够访问这些属性..但我不能。
谁能给我一些关于如何做到这一点的想法?
【问题讨论】:
标签: c# asp.net-mvc linq entity-framework linq-to-entities