// GET: Employees/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Employee employee = db.Employee.Find(id); if (employee == null) { return(HttpNotFound()); } var ne = new DetailEmployeeViewModel { Id = employee.Id, Addresses = this.db.AddressEmployee.Where(a => a.IdEMP == employee.Id), HireDate = employee.HireDate, Name = employee.Name, Salary = employee.Salary, Telephones = this.db.TelephoneEmployee.Where(t => t.IdEMP == employee.Id) }; return(View(ne)); }
public DetailEmployee(Employee employee) { if (employee == null) { throw new ArgumentException(); } viewModel = new DetailEmployeeViewModel(employee); BindingContext = viewModel.Employee; InitializeComponent(); }