public IActionResult Edit(int?id) { var model = id != null ? new EditBreakdownViewModel(_service.GetBreakdownItem(id.Value)) : new EditBreakdownViewModel(); model.BreakdownTypes = _service.GetBreakdownTypeItems().Select(x => new SelectListItem(x.BreakdownTypeName, x.Id.ToString())); model.Machines = _service.GetMachineItems().Select(x => new SelectListItem(x.MachineName, x.Id.ToString())); model.PersonnelsRequesting = _service.GetPersonnelItems() .Select(x => new SelectListItem(x.FirstName + " " + x.LastName, x.Id.ToString())); model.PersonnelsMaintenance = _service.GetPersonnelItems() .Select(x => new SelectListItem(x.FirstName + " " + x.LastName, x.Id.ToString())); model.Urgencies = _service.GetUrgencyItems() .Select(x => new SelectListItem(x.UrgencyLevel, x.Id.ToString())); model.Plants = _service.GetPlantItems() .Select(x => new SelectListItem(x.PlantName, x.Id.ToString())); return(View(model)); }