示例#1
0
        private void ListarPersonal(int id)
        {
            IEnumerable <PersonalDTO> personalList = personalService.ListarPersonal(id);

            ViewBag.ListarPersonal = WebHelper.ToSelectListItem <PersonalDTO>(personalList
                                                                              , x => x.PersonalId.ToString(), x => x.Nombres, SelectListFirstElementType.Select, string.Empty);
        }
示例#2
0
        public async Task <IActionResult> GetListarPersonal()
        {
            try
            {
                {
                    var identity  = HttpContext.User.Identity as ClaimsIdentity;
                    int idUsuario = JwtConfigurator.GetTokenIdUsuario(identity);

                    var personal = await _PersonalService.ListarPersonal();

                    return(Ok(personal));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        //[HttpPost]
        public async Task <JsonResult> GetPersonal(string nombre)
        {
            JsonResultMessage jsonResultMessage = new JsonResultMessage();

            try
            {
                IEnumerable <PersonalDTO> listarPesonal = await personalService.ListarPersonal(nombre);

                var dataJson = from f in listarPesonal.ToList()
                               select new
                {
                    f.PersonalId,
                    f.Nombres
                };
                jsonResultMessage.data = dataJson;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(jsonResultMessage, JsonRequestBehavior.AllowGet));
        }
示例#4
0
        public async Task <JsonResult> GetPersonal(string query)
        {
            JsonResultMessage jsonResultMessage = new JsonResultMessage();

            try
            {
                IEnumerable <PersonalDTO> personalDTOList = await _personalService.ListarPersonal(query);

                var jsonData = from f in personalDTOList.AsEnumerable()
                               select new
                {
                    f.PersonalId,
                    f.Nombres
                };
                jsonResultMessage.data = jsonData;
            }
            catch (Exception ex)
            {
                jsonResultMessage.message = ex.Message;
                jsonResultMessage.success = false;
            }
            return(Json(jsonResultMessage, JsonRequestBehavior.AllowGet));
        }