//Action for edit Presences public IActionResult Edit(int?id) { //Test if id is null if (id == null) { return(NotFound()); } //Test if id exists var obj = _presenceService.FindById(id.Value); if (obj == null) { return(NotFound()); } //Open Edit Screen List <Employee> employees = _employeeService.FindAll(); var viewModel = new PresenceFormViewModel { Presence = obj, Employees = employees }; //Return view return(View(viewModel)); }
//Return to create Presence page public IActionResult Create() { //Load Employees from Database var employees = _employeeService.FindAll(); var viewModel = new PresenceFormViewModel { Employees = employees }; return(View(viewModel)); }