📅  最后修改于: 2022-03-11 14:49:16.142000             🧑  作者: Mango
[HttpGet]
public virtual ActionResult Edit(int id)
{
Employee entity = GetEntityById(id);
EmployeeEditViewModel model = new EmployeeEditViewModel();
Mapper.Map(source, destination);
return View("Edit", model);
}
[HttpPost]
public virtual ActionResult Edit(EmployeeEditViewModel model)
{
if (ModelState.IsValid)
{
Employee entity = GetEntityById(model.Id);
entity = Mapper.Map(model, entity);
EntitiesRepository.Save(entity);
return GetIndexViewActionFromEdit(model);
}
return View("Edit", model);
}