Example #1
0
        public ActionResult add(HttpPostedFileBase file, proyectPro pro)
        {
            string extencion = Path.GetExtension(file.FileName);

            if (extencion == ".png" || extencion == ".jpeg" || extencion == ".jpg" || extencion == "")
            {
                pro.img = file.FileName.Trim();
                dao.agregarProyect(pro);
                var fileName = Path.GetFileName(file.FileName.Trim());
                var path     = Path.Combine(Server.MapPath("~/img-pro/"), fileName);
                if (extencion != "")
                {
                    file.SaveAs(path);
                }
                mensaje = "Registro guardado";
                val     = "1";
            }
            else
            {
                mensaje = "El formato para la imagen es de tipo: jpg,jpeg o png";
                val     = "0";
            }

            return(Redirect("/proyect/Index"));
        }
Example #2
0
        public ActionResult delete(string id)
        {
            proyectPro proyect = new proyectPro();

            proyect.id = Convert.ToInt32(id);
            dao.deleteProyect(proyect.id);
            return(RedirectToAction("Index"));
        }