var ticketnumber = TempData["ticketId"] as Ticket;
ticketnumber.TicketId = model.TicketId;
db.SaveChanges();
HttpPostedFileBase file = Request.Files["ImageData"];
UploadRepository service = new UploadRepository();
int i = service.UploadImageInDataBase(file, model);
我的tempdata中有值,但是当我尝试将它的值分配给模型值时它不会保存,甚至在调试中它告诉我值没有改变所以我只是不知道我做错了什么。 / p>
答案 0 :(得分:0)
您需要更改作业:
自:
ticketnumber.TicketId = model.TicketId;
要:
model.TicketId = ticketnumber.TicketId;