想在插入数据后跳转到MEdit的页面,必须要抓取这个BidId.现在的问题应该是不会抓取当前的BidId。
public ActionResult Create(int bid, int sid, string sname, string btype, string btitle, string detail, int budget, DateTime bend)
{
var model = new BidF();
model.BidId = bid;
model.UserId = User.Identity.GetUserId();
model.UserName = User.Identity.GetUserName();
model.StoreId = sid;
model.StoreName = sname;
model.Title = btitle;
model.BidType = btype;
model.FBudget = budget;
model.FDetail = detail;
model.BidEnd = bend;
return View(model);
}
// POST: BidFs/Create
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
// more details see https://go.microsoft.com/fwlink/?LinkId=317598.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create([Bind(Include = "Id,BidId,UserId,UserName,Title,BidType,BidEnd,Paid,StoreId,StoreName,FBudget,FDetail,DeliveryStart,DeliveryFinish")] BidF bidF)
{
if (ModelState.IsValid)
{
db.BidFs.Add(bidF);
db.SaveChanges();
return RedirectToAction("MEdit","Bids");
}
return View(bidF);
}