I want to bind controls on my razor view but getting error:
here is my Order model:
public class OrderViewModel
{
public int Id { get; set; }
public AreaCatalog Area { get; set; }
[Display(Name="Sub Total")]
public int SubTotal { get; set; }
public int Discount { get; set; }
[Display(Name = "Delivery Fee")]
public int DeliveryFee { get; set; }
[Display(Name = "Total Amount")]
public int TotalAmount { get; set; }
public List<ProductViewModel> Product { get; set; }
}
that is included in ProductOrderViewModel as below:
public class ProductOrderViewModel
{
public List<ProductViewModel> Products { get; set; }
public List<OrderViewModel> Orders { get; set; }
}
here is my controller code:
public ActionResult Edit()
{
ResponseModel result = new ResponseModel();
result = new Logic().GetProducts();
//var model = new ProductOrderViewModel() { Products = result.Model, Orders = yy };
var model = new ProductOrderViewModel() { Products = result.Model };
if (result.Success)
return View(model);
return View();
}
and here is my view code:
@model ProductOrderViewModel
@using Helpers
@using ViewModels;
@{
ViewBag.Title = "Edit";
}
@Html.EnumDropDownListFor(m => m.Orders.Area, new { @name = "area", @style = "width:295px; height:25px;margin-left:5px;" })
and Error is :
does not contain a definition for 'Area' and no extension method 'Area' accepting a first argument of type 'System.Collections.Generic.List
Please guide me through this problem
Orderscan you show the class?