Это мой код (просмотр):
Код: Выделить всё
@using (Html.BeginForm("Index3", "Upload", FormMethod.Post))
{
@Html.TextBoxFor(x => x.Itemname, new { @class = "form-control", placeholder = "Item name", required = "required" })
@Html.TextBoxFor(x => x.Price, new { @class = "form-control", placeholder = "Item price", required = "required" })
@Html.TextBoxFor(x => x.Quantity, new { @class = "form-control", placeholder = "Item quantity"})
@Html.TextBoxFor(x => x.AuthorIdentity, new { @class = "form-control", placeholder = "Username", required = "required" })
// THIS IS WHERE MY IMAGE UPLOAD SHOULD BE
@Html.TextBoxFor(x => x.Category, new { @class = "form-control", placeholder = "Item category", required = "required" })
@Html.TextAreaFor(x => x.Description, new { @class = "form-control", placeholder = "Item description", required = "required" })
}
Код: Выделить всё
public ActionResult Index3(ShoppingItem formModel);
{
using (var ctx = new GikGamerModelDataContext())
{
if (formModel == null)
return View();
ctx.ShoppingItems.InsertOnSubmit(formModel);
ctx.SubmitChanges();
}
return View();
}
Подробнее здесь: https://stackoverflow.com/questions/413 ... th-c-sharp