public IActionResult Editar(int id = 0) { PersonalDTO personal; if (id == 0) //nuevo { personal = new PersonalDTO(); } else //editar { personal = _personalService.ObtenerPorId(id); } var listItemsEmpresas = from e in _empresaService.Listar() select new SelectListItem { Text = e.RazonSocial, Value = e.IdEmp.ToString() }; var listItemsAreas = from a in _areaService.Listar() select new SelectListItem { Text = a.Descripcion, Value = a.IdAre.ToString() }; var listItemsCargos = from c in _cargoService.Listar() select new SelectListItem { Text = c.Descripcion, Value = c.IdCar.ToString() }; ViewBag.areas = listItemsAreas; ViewBag.cargos = listItemsCargos; ViewBag.empresas = listItemsEmpresas; ViewBag.listItemsGeneros = genero.listItemsGeneros; ViewBag.listItemsEstados = estado.listItemsEstados; return(View(personal)); }
public IActionResult Recuperar(int id) { var personal = _personalService.ObtenerPorId(id); if (personal == null) { return(BadRequest("El codigo que enviaste no existe")); } return(Ok(personal)); }
public IActionResult Detalle(int id = 0) { UsuarioDTO usuario; if (id <= 0) { return(RedirectToAction("Index")); } usuario = _usuarioService.ObtenerPorId(id); if (usuario == null) { return(RedirectToAction("Index")); } var personal = _personalService.ObtenerPorId(usuario.IdPer); ViewBag.personal = personal.Nombre + " " + personal.ApellidoPaterno + " " + personal.ApellidoMaterno; ViewBag.tipoUsuario = _tipoUsuarioService.ObtenerPorId(usuario.IdTip).Descripcion; return(View(usuario)); }