数据库中有两张表,商品信息表和商品评价表。页面上面是商品的信息,下面是要求用户填写的评价表。
@model Udp.Model.Car_Goods_Info
@{
ViewBag.Title = "评价";
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="@Url.Content("~/css/goods.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/js/jquery-1.5.2.min.js")" type="text/javascript"></script>
</head>
<body scroll="no">
<div>
@using (Html.BeginForm("SaveCar_Goods_pj", "Goods", FormMethod.Post, new { id = "frmAdminSet" }))
{
@Html.ValidationSummary(true)
@Html.HiddenFor(m => m.ID)
<table cellpadding="0" cellspacing="0" class="CarTable" width="750px">
<tr>
<td class="tabletitle">
商品名:
</td>
<td style="width: 150px;">
@Model.GoodsName
@Html.HiddenFor(m => m.GoodsName)
</td>
<td class="tabletitle">
产地:
</td>
<td style="width: 150px;">
@Model.Place
@Html.HiddenFor(m => m.Place)
</td>
//商品信息字段比较多,在此就不一一写了,样式就是这样的
</tr>
</table>
//用户评价应该写在这个form里面,还是外面?
}
</div>
</body>
</html>
现在我要实现用户评价后修改商品信息表的Stat字段(表示是否用户评价过),并且将评价信息插入商品评价表。如何同时操作两个数据表?有@model Udp.Model.Car_Goods_Info,就不能再有@model Udp.Model.Car_Assess_Info
怎么解决?
@model Udp.Model.Car_Goods_Info
@{
ViewBag.Title = "评价";
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title></title>
<link href="@Url.Content("~/css/goods.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/js/jquery-1.5.2.min.js")" type="text/javascript"></script>
</head>
<body scroll="no">
<div>
@using (Html.BeginForm("SaveCar_Goods_pj", "Goods", FormMethod.Post, new { id = "frmAdminSet" }))
{
@Html.ValidationSummary(true)
@Html.HiddenFor(m => m.ID)
<table cellpadding="0" cellspacing="0" class="CarTable" width="750px">
<tr>
<td class="tabletitle">
商品名:
</td>
<td style="width: 150px;">
@Model.GoodsName
@Html.HiddenFor(m => m.GoodsName)
</td>
<td class="tabletitle">
产地:
</td>
<td style="width: 150px;">
@Model.Place
@Html.HiddenFor(m => m.Place)
</td>
//商品信息字段比较多,在此就不一一写了,样式就是这样的
</tr>
</table>
//用户评价应该写在这个form里面,还是外面?
}
</div>
</body>
</html>
现在我要实现用户评价后修改商品信息表的Stat字段(表示是否用户评价过),并且将评价信息插入商品评价表。如何同时操作两个数据表?有@model Udp.Model.Car_Goods_Info,就不能再有@model Udp.Model.Car_Assess_Info
怎么解决?
{
public Udp.Model.Car_Goods_Info GoodsInfo { get; set; }
public Udp.Model.Car_Assess_Info AssessInfo { get; set; }
}
@model GoodsInfoAndAssessInfo