amigos.. もう 1 つ問題があります。ばかかもしれませんが、何が悪いのかわかりません。
public ActionResult Images(Guid? id)
{
ViewBag.Gallery = _core.GetGalleryByID(_client, (Guid)id);
List<ImageModel> models = new List<ImageModel>();
foreach (var img in _core.GetImagesByGalleryID(_client, (Guid)id))
{
ImageModel model = new ImageModel(_client);
model.Thumbneil = img.Thumbneil;
model.Description = img.Description;
model.AlternateText = img.AlternateText;
model.GalleryID = img.GalleryID;
model.ID = img.ID;
models.Add(model);
}
ViewBag.Images = models;
return View();
}
[HttpPost]
public ActionResult SaveImageInfo(ImageModel imageModel)
{
Image img = _core.GetImageByID(_client, imageModel.ID);
img.AlternateText = imageModel.AlternateText;
img.Description = imageModel.Description;
_core.SaveImageInfo(_client, img);
return View();
}
これはコントローラーの一部です。これはビューの一部です:
@model WebUI.Models.ImageModel
@{
ViewBag.Title = "Images";
Layout = "~/Views/Admin/_Layout.cshtml";
}
<h2>@ViewBag.Gallery.Name</h2>
<table id="grid-table" >
@foreach (var image in ViewBag.Images)
{
<tr>
....
<td >
@using(Html.BeginForm("SaveImageInfo", "Admin", FormMethod.Post))
{
@Html.HiddenFor(m => m.ID)
@Html.TextAreaFor(m => m.Description) <br />
@Html.TextBoxFor(m => m.AlternateText) <br />
<div id="item-post" >
<input title="Подтвердить" type="submit" value="Подтвердить" />
</div>
}
</td>
</tr>
}
</table>
そしてモデル:
public class ImageModel
{
public Byte[] Thumbneil { get; set; }
[Required]
public String Description { get; set; }
[Required]
public Guid GalleryID { get; set; }
[Required]
public String AlternateText { get; set; }
[Required]
public Guid ID { get; set; }
}
ActionResult SaveImageInfo(ImageModel imageModel) には、ID と GalleryID の 2 つの Guid が必要です。しかし。私はこれを持っています: そしてこれが私の質問です: なぜ? 見えない...