asp.mvc3问题,请赐教……

jisuanjizhuan 2013-08-15 05:24:38
数据库中有两张表,商品信息表和商品评价表。页面上面是商品的信息,下面是要求用户填写的评价表。

@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
怎么解决?
...全文
115 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jisuanjizhuan 2013-08-16
  • 打赏
  • 举报
回复
引用 2 楼 caozhy 的回复:
class GoodsInfoAndAssessInfo { public Udp.Model.Car_Goods_Info GoodsInfo { get; set; } public Udp.Model.Car_Assess_Info AssessInfo { get; set; } } @model GoodsInfoAndAssessInfo
不愧是版主,貌似顿开!!!赞!
「已注销」 2013-08-15
  • 打赏
  • 举报
回复
mark,收藏。
threenewbee 2013-08-15
  • 打赏
  • 举报
回复
class GoodsInfoAndAssessInfo { public Udp.Model.Car_Goods_Info GoodsInfo { get; set; } public Udp.Model.Car_Assess_Info AssessInfo { get; set; } } @model GoodsInfoAndAssessInfo
shaqiman123 2013-08-15
  • 打赏
  • 举报
回复
你需要些两个table一个table里面放一张表在做查询用session绑定也可以

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧