public RespuestaBD EditarPruebasNoRealizadas(ActualizarPruebasNoRealizadas actualizarPruebasNoRealizadas) { using (InoBD db = new InoBD()) { PruebasNoRealizadas pruebasNoRealizadas = db.PruebasNoRealizadas.Find(actualizarPruebasNoRealizadas.IdPruebasNoRealizadas); string valoresAntiguos = JsonConvert.SerializeObject(pruebasNoRealizadas); if (pruebasNoRealizadas != null) { PruebasNoRealizadas pacienteEncontrado = db.PruebasNoRealizadas.Where(x => x.HistoriaClinica == actualizarPruebasNoRealizadas.HistoriaClinica && x.FechaOcurrencia == actualizarPruebasNoRealizadas.FechaOcurrencia && x.IdPruebasNoRealizadas != actualizarPruebasNoRealizadas.IdPruebasNoRealizadas).FirstOrDefault(); if (pacienteEncontrado == null) { db.Entry(pruebasNoRealizadas).CurrentValues.SetValues(actualizarPruebasNoRealizadas); db.SaveChanges(); //Mensaje de respuesta respuesta.Id = pruebasNoRealizadas.IdPruebasNoRealizadas; respuesta.Mensaje = "Se modificó los datos correctamente."; // Auditoria AuditoriaGeneral auditoria = new AuditoriaGeneral { Accion = "Actualizar", NombreTabla = "PruebasNoRealizadas", ValoresAntiguos = valoresAntiguos, ValoresNuevos = JsonConvert.SerializeObject(actualizarPruebasNoRealizadas), IdUsuario = actualizarPruebasNoRealizadas.IdUsuarioModificacion }; this._gestorDeAuditoria.AgregarAuditoria(auditoria); } else { //Mensaje de respuesta respuesta.Id = 0; respuesta.Mensaje = "El paciente ya se encuentra registrado para esta fecha."; return(respuesta); } } else { //Mensaje de respuesta respuesta.Id = 0; respuesta.Mensaje = "El campo solicitado no existe."; } return(respuesta); } }
public RespuestaBD EditarPruebasNoRealizadas(ActualizarPruebasNoRealizadas actualizarPruebasNoRealizadas) { return(_gestorDeTomaMuestra.EditarPruebasNoRealizadas(actualizarPruebasNoRealizadas)); }