示例#1
0
        //
        // GET: /Foto/Details/5

        public ActionResult Details(int id)
        {
            IList <ComentarioEN> lista       = new List <ComentarioEN>();
            IList <ComentarioEN> listaevento = new List <ComentarioEN>();
            FotoModelo           fom         = null;

            SessionInitialize();
            FotoEN repEN = new FotoCAD(session).ReadOIDDefault(id);

            fom = new FotoAssembler().ConvertENToModelUI(repEN);
            ComentarioCEN comentarios = new ComentarioCEN();

            lista = comentarios.ReadAll(0, -1);
            foreach (ComentarioEN item in lista)
            {
                if (item.Foto != null)
                {
                    if (item.Foto.Id == id)
                    {
                        listaevento.Add(item);
                    }
                }
            }
            ViewData["lista"] = listaevento;
            ViewBag.gal       = repEN.Pertenece_a.Id;
            ViewBag.Us        = repEN.Pertenece_a.Evento.Crea.Nick;
            SessionClose();
            return(View(fom));
        }
示例#2
0
        //
        // GET: /Foto/Create

        public ActionResult Create()
        {
            FotoModelo fot   = new FotoModelo();
            String     idr   = RouteData.Values["id"].ToString();
            int        idref = Int32.Parse(idr);

            fot.idgaleria = idref;
            return(View(fot));
        }
示例#3
0
        //
        // GET: /Foto/Edit/5

        public ActionResult Edit(int id)
        {
            FotoModelo com = null;

            SessionInitialize();
            FotoEN en = new FotoCAD(session).ReadOIDDefault(id);

            com = new FotoAssembler().ConvertENToModelUI(en);
            SessionClose();
            return(View(com));
        }
示例#4
0
 public ActionResult Edit(int id, FotoModelo fot)
 {
     try
     {
         FotoCEN cen = new FotoCEN();
         FotoEN  en  = cen.ReadOID(id);
         cen.EditarFoto(id, fot.nombre, en.Usuario, fot.descripcion, en.Likes, en.Ruta);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#5
0
        //MÉTODO DAR LIKE
        public ActionResult Darlike(int id)
        {
            FotoModelo com = null;

            SessionInitialize();
            FotoEN en = new FotoCAD(session).ReadOIDDefault(id);

            com = new FotoAssembler().ConvertENToModelUI(en);
            SessionClose();
            FotoCEN cen = new FotoCEN();

            en.Likes++;
            cen.EditarFoto(id, en.Nombre, en.Usuario, en.Descripcion, en.Likes, en.Ruta);
            return(RedirectToAction("Details", "Foto", new { id = id }));
        }
示例#6
0
        public ActionResult Create(FotoModelo fot, HttpPostedFileBase file)
        {
            string fileName = "", path = "";

            // Verify that the user selected a file
            if (file != null && file.ContentLength > 0)
            {
                // extract only the fielname
                fileName = Path.GetFileName(file.FileName);
                // store the file inside ~/App_Data/uploads folder
                path = Path.Combine(Server.MapPath("~/Images/Uploads"), fileName);
                //string pathDef = path.Replace(@"\\", @"\");

                file.SaveAs(path);
            }


            fileName = "/Images/Uploads/" + fileName;
            FotoCP cp = new FotoCP();

            cp.SubirFoto(fot.nombre, "perico el de los palotes", fot.descripcion, 0, fileName);
            return(RedirectToAction("Index"));
        }
示例#7
0
        //
        // GET: /Foto/Create

        public ActionResult Create()
        {
            FotoModelo fot = new FotoModelo();

            return(View(fot));
        }