点击提交按钮后。我在实体中得到空值。 有人有解决方案吗?
看法
@using (Ajax.BeginForm("CreateRoom", "Room", new AjaxOptions { HttpMethod = "POST", OnComplete = "window.location.href='Index'" }, new { enctype = "multipart/form-data", id = "ajaxUploadForm" }))
{
<input type="file" name="Room" />
<input type="submit" value="OK" />
}
控制器
[HttpPost]
public ActionResult CreateRoom(RoomFileView entity)
{
//code
}
模型
public class RoomFileView
{
public RoomFileView();
public int BuildingId { get; set; }
public int CityId { get; set; }
public int CountryId { get; set; }
public int FloorId { get; set; }
public int LocationId { get; set; }
public HttpPostedFileWrapper Room { get; set; }
public string Content();
}