I've this data model
public partial class UsersInfo
{
public int UserID { get; set; }
public string Name_f { get; set; }
public string Name_l { get; set; }
public string Photo { get; set; }
public bool ActiveAccount { get; set; }
}
public partial class Employee
{
public int EmpID { get; set; }
public int BranchID { get; set; }
public virtual UsersInfo UsersInfo { get; set; }
}
and i'm rendering this form
@model LoanApp.Models.DataBaseModel.Employee
@using (Html.BeginForm((string)ViewBag.Contoler, "Employe", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
@Html.Partial("~/Views/Shared/_userInfo.cshtml",Model.UsersInfo)
<label class="control-label">يعمل في فــرع</label>
@Html.DropDownList("BranchID", null, htmlAttributes: new { @class = "form-control" })
<input type="submit" value="Save" class="btn btn default" />
}
and this is my partial view
@model LoanApp.Models.DataBaseModel.UsersInfo
@Html.TextBoxFor(x => x.Name_f, new { @class = "form-control", @placeholder = "الاسم الاول", @required = "" })
@Html.TextBoxFor(x => x.Name_l, new { @class = "form-control", @placeholder = "الاسم الاخير", @required = "" })
@Html.TextBoxFor(x => x.PhoneNumber, new { @class = "form-control", @required = "", @number = "true" })
I want my post edit method to has the object from userinfo instead of null, I'm not sure what i'm missing
I've one to one relation between table employee and users info