Example #1
0
        public string CrearAlquiler(string titulo, string descripcion, string direccion, string ubicacion, float precio, string uri)
        {
            if (titulo == "" || direccion == "" || precio == 0 || uri == "")
            {
                throw new Exception("Falta informacion");
            }

            if (!usuario.isLogged())
            {
                throw new Exception("Es necesario estar loggeado");
            }

            Data.Inmueble inmueble = new Data.Inmueble();
            try
            {
                logs.createLog($"post created: {Entities.Session._id}");
                return(inmueble.AgregarInmueble(
                           new Entities.Inmueble(
                               Guid.NewGuid().ToString(),
                               titulo,
                               descripcion,
                               direccion,
                               ubicacion,
                               precio,
                               uri
                               )
                           ));
            }
            catch (Exception error)
            {
                throw new Exception(error.Message);
            }
        }
Example #2
0
 public List <Entities.Inmueble> TraerInmuebles(string busqueda)
 {
     Data.Inmueble inmueble = new Data.Inmueble();
     try
     {
         return(inmueble.TraerInmuebles(busqueda));
     }
     catch (Exception error)
     {
         throw new Exception(error.Message);
     }
 }
Example #3
0
 public List <Entities.Comentario> TraerComentarios(string id)
 {
     Data.Inmueble inmueble = new Data.Inmueble();
     try
     {
         return(inmueble.TraerComentarios(id));
     }
     catch (Exception error)
     {
         throw new Exception(error.Message);
     }
 }
Example #4
0
 public List <string> TraerPaises()
 {
     Data.Inmueble inmueble = new Data.Inmueble();
     try
     {
         return(inmueble.TraerPaises());
     }
     catch (Exception error)
     {
         throw new Exception(error.Message);
     }
 }
Example #5
0
        public Entities.Inmueble TraerInmueble(string id)
        {
            Data.Inmueble inmueble = new Data.Inmueble();

            try
            {
                return(inmueble.TraerInmueble(id));
            }
            catch (Exception error)
            {
                throw new Exception(error.Message);
            }
        }
Example #6
0
 public List <Entities.Inmueble> TraerAlquileres()
 {
     if (!usuario.isLogged())
     {
         throw new Exception("Es necesario estar loggeado");
     }
     Data.Inmueble inmueble = new Data.Inmueble();
     try
     {
         return(inmueble.TraerAlquileres(Entities.Session._id));
     }
     catch (Exception error)
     {
         throw new Exception(error.Message);
     }
 }
Example #7
0
 public string BorrarFavoritos(string id)
 {
     if (!usuario.isLogged())
     {
         throw new Exception("Es necesario estar loggeado");
     }
     Data.Inmueble inmueble = new Data.Inmueble();
     try
     {
         logs.createLog($"fav deleted: {Entities.Session._id}");
         return(inmueble.BorrarFavoritos(id, Entities.Session._id));
     }
     catch (Exception error)
     {
         throw new Exception(error.Message);
     }
 }
Example #8
0
 public string AgregarFavoritos(string id)
 {
     Data.Inmueble inmueble = new Data.Inmueble();
     try
     {
         if (!usuario.isLogged())
         {
             throw new Exception("Es necesario estar loggeado");
         }
         logs.createLog($"fav created: {Entities.Session._id}");
         return(inmueble.AgregarFavoritos(Guid.NewGuid().ToString(), id, Entities.Session._id));
     }
     catch (Exception error)
     {
         throw new Exception(error.Message);
     }
 }
Example #9
0
        public string AgregarComentario(Entities.Comentario comentario)
        {
            if (!usuario.isLogged())
            {
                throw new Exception("Es necesario estar loggeado");
            }
            if (!validarComentario(comentario))
            {
                throw new Exception("Por favor verifica que los datos esten completos");
            }


            Data.Inmueble inmueble = new Data.Inmueble();
            try
            {
                logs.createLog($"comment created: {Entities.Session._id}");
                return(inmueble.AgregarComentario(comentario));
            }
            catch (Exception error)
            {
                throw new Exception(error.Message);
            }
        }