【发布时间】:2022-01-23 11:38:21
【问题描述】:
public ActionResult Index()
{
GetEmployee();
return View();
}
private void GetEmployee()
{
SocialMedia item = new SocialMedia();
var employee = _employeeRepository.GetById(Session.GetEmployeeNo());
//employee.No, employee.ManagerNo
item.FirstName = employee.FirstName;
item.LastName = employee.LastName;
item.Departmen = employee.PositionCode;
item.FullName = item.FirstName + " " + item.LastName;
}
还有我的 HTML
@using Models.Model
@model Models.Model.SocialMedia
<div>
@Html.LabelFor(model => model.FullName)
</div>
<div>
@Html.LabelFor(model=>model.Departmen)
</div>
我的结果是
全名 部门
姓名,姓氏和部门应该来但没有。 你能帮我吗
【问题讨论】:
-
您的数据永远不会从 GetEmployee() 方法中暴露出来。该方法可能需要有一个返回值,您需要将它传递给 View() 方法
标签: javascript c# html css asp.net