示例#1
0
        public ViewModel.Response.CoeficienteBusquedaResponce GetCoeficienteBusqueda(CoeficienteBusquedaIngresadoRequest request)
        {
            if (request is null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var entity = CurrentContext.DataContext.Pacientes.Include(x => x.TipoDocumento)
                         .FirstOrDefault(x => x.Id == request.PacienteId);

            if (entity == null)
            {
                throw new Exception($"Paciente inexistente con ID:{request.PacienteId}");
            }

            var rq = new CoeficienteBusquedaRequest
            {
                ApellidoIngresado        = request.ApellidoIngresado,
                ApellidoObtenido         = entity.PrimerApellido,
                FechaNacimientoIngresado = request.FechaNacimientoIngresado,
                FechaNacimientoObtenido  = entity.FechaNacimiento.ToString("dd/MM/yyyy"),
                NombreIngresado          = request.NombreIngresado,
                NombreObtenido           = entity.PrimerNombre,
                NroDocumentoIngresado    = request.NroDocumentoIngresado,
                NroDocumentoObtenido     = entity.NroDocumento.ToString(),
                SexoIngresado            = request.SexoIngresado,
                SexoObtenido             = entity.Sexo,
                TipoDocumentoIngresado   = request.TipoDocumentoIngresado,
                TipoDocumentoObtenido    = entity.TipoDocumento.Nombre
            };

            var ret = GetCoeficienteBusqueda(rq);

            return(ret);
        }
示例#2
0
        public JsonResult GetCoeficienteBuqueda(CoeficienteBusquedaIngresadoRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(new JsonResult(new { success = false, message = FriendlyErrors() })
                {
                    StatusCode = 200
                });
            }

            try
            {
                var resp  = _pacienteAppService.GetCoeficienteBusqueda(request);
                var table = this.RenderViewToStringAsync("Partials/_GridCoeficienteBusqueda", resp).Result;
                return(new JsonResult(new { success = true, message = "", table })
                {
                    StatusCode = 200
                });
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Error obteniendo datos");
                return(new JsonResult(new { message = ex.Message })
                {
                    StatusCode = 500
                });
            }
        }