public String RegistrarHorario(Horario horarioACrear) { Horario horarioObtenido = dao.Obtener(horarioACrear.Codigo, horarioACrear.Dia); Horario horarioRegistrado = null; if (horarioObtenido == null) { horarioRegistrado = dao.Crear(horarioACrear); } else { throw new WebFaultException <Error>( new Error() { Codigo = "ERR003", Mensaje = "Horario ya registrado" }, HttpStatusCode.InternalServerError); } if (horarioRegistrado == null) { throw new WebFaultException <Error>( new Error() { Codigo = "ERR002", Mensaje = "No fue posible registrar el horario" }, HttpStatusCode.InternalServerError); } return("El horario del espacio deportivo registrado exitosamente"); }
public Horario CrearHorario(Horario horarioACrear) { return(dao.Crear(horarioACrear)); }