public void AgregarPuntaje(Antecedente antecedente, Victima victima) { if (antecedente == null) { throw new FaultException(Lenguaje.AntecedenteNoValido); } antecedente = RepositorioAntecedentes.DevolverPorId(antecedente.Id); if (antecedente == null) { throw new FaultException(Lenguaje.AntecedenteNoExiste); } if (victima == null) { throw new FaultException(Lenguaje.VictimaNoValida); } victima = RepositorioVictimas.DevolverPorId(victima.Id); if (victima == null) { throw new FaultException(Lenguaje.VictimaNoExiste); } RepositorioAntecedentes.InsertarPuntajes(antecedente, victima); }
public Antecedente DevolverAntecedentePorId(int id, bool puntajes) { var antecedente = RepositorioAntecedentes.DevolverPorId(id, puntajes); if (antecedente == null) { throw new FaultException(Lenguaje.AntecedenteNoExiste); } return(antecedente); }
public void EliminarAntecedente(Antecedente antecedente) { if (antecedente == null) { throw new FaultException(Lenguaje.AntecedenteNoValido); } antecedente = RepositorioAntecedentes.DevolverPorId(antecedente.Id); if (antecedente == null) { throw new FaultException(Lenguaje.AntecedenteNoExiste); } RepositorioAntecedentes.Eliminar(antecedente); }
public void ModificarAntecedente(Antecedente antecedente) { if (antecedente == null) { throw new FaultException(Lenguaje.AntecedenteNoValido); } var antecedenteModificar = RepositorioAntecedentes.DevolverPorId(antecedente.Id); if (antecedenteModificar == null) { throw new FaultException(Lenguaje.AntecedenteNoExiste); } if (String.IsNullOrWhiteSpace(antecedente.Nombre)) { throw new FaultException(Lenguaje.NombreNoValido); } if (String.IsNullOrWhiteSpace(antecedente.Perjuicios)) { throw new FaultException(Lenguaje.PerjuiciosNoValidos); } if (antecedente.Fecha == null) { throw new FaultException(Lenguaje.FechaNoValida); } if (String.IsNullOrWhiteSpace(antecedente.Ubicacion)) { throw new FaultException(Lenguaje.UbicacionNoValida); } if (antecedente.Estado == null) { throw new FaultException(Lenguaje.EstadoNoValido); } if (RepositorioEstados.DevolverPorId(antecedente.Estado.Id) == null) { throw new FaultException(Lenguaje.EstadoNoValido); } if (antecedente.Victima == null) { throw new FaultException(Lenguaje.VictimaNoValida); } var victima = RepositorioVictimas.DevolverPorId(antecedente.Victima.Id); if (victima == null || victima.EstaBorrado == true) { throw new FaultException(Lenguaje.VictimaNoExiste); } if (antecedente.Agresor == null) { throw new FaultException(Lenguaje.AgresorNoValido); } var agresor = RepositorioAgresores.DevolverPorId(antecedente.Agresor.Id); if (agresor == null || agresor.EstaBorrado == true) { throw new FaultException(Lenguaje.AgresorNoExiste); } antecedenteModificar.Estado = antecedente.Estado; antecedenteModificar.Nombre = antecedente.Nombre; antecedenteModificar.Victima = antecedente.Victima; antecedenteModificar.Agresor = antecedente.Agresor; antecedenteModificar.Fecha = antecedente.Fecha; antecedenteModificar.Observaciones = antecedente.Observaciones; antecedenteModificar.Perjuicios = antecedente.Perjuicios; antecedenteModificar.Ubicacion = antecedente.Ubicacion; antecedenteModificar.Latitud = antecedente.Latitud; antecedenteModificar.Longitud = antecedente.Longitud; RepositorioAntecedentes.Modificar(antecedenteModificar); }