アプリケーションに沿ったメソッドが返す ActionResult というエンティティがあります。ここで、ActionResult で返されたオブジェクトを、そのオブジェクトの配列内の適切な場所にマップしたいと考えています...
public class Core
{
public Employee[] Employees = new[] {
new Employee {
Name = "Jack",
Age = 21,
Salary = 1000
},
new Employee {
Name = "Carl",
Age = 35,
Salary = 1000
},
new Employee {
Name = "Tom",
Age = 41,
Salary = 1000
},
};
}
public class ActionResult
{
public string ActionID { get; set; }
public Employee Employee { get; set; }
}
public class Employee
{
public String Name { get; set; }
public int? Age { get; set; }
public int? Salary { get; set; }
public int? Level { get; set; }
}
public ActionResult MethodThatReturnsActionResultWithAnEmployee()
{
return new ActionResult {
ActionID = new Guid().ToString(),
Employee = new Employee {
Name = "Carl",
Age = 35,
Salary = 7000,
Level = 1
}
};
}
ご覧のとおり、私がやりたいことは、メソッドから返された従業員を取得し、コア内の従業員の配列を検索し、AutoMapper を使用して新しい特定のデータを使用して更新することです。