I've been trying to dissect an automated MVC view & controller, and modify it so that i can insert information from a form in the view, on to two separate database tables (Entity framework database first).
here's what i have so far. it works if i reference either of the namespaces at the top on their own, but not together?
@model manage.mysite.DataModels.Property_Type
@model manage.mysite.DataModels.Room_Type
@{
ViewBag.Title = "Create";
}
<h2>Create</h2>
@using (Html.BeginForm())
{
<div class="form-horizontal">
<h4>Property_Type</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.PropertyType, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.PropertyType, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.PropertyType, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.RoomType, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.RoomType, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.RoomType, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}