コード例 #1
0
        public ActionResult AddEvento(Evento evento)
        {
            String imagen = "";

            try
            {
                HttpPostedFileBase file = Request.Files[0];
                file = Request.Files[0];
                string ruta = Server.MapPath("~/Content/images/");
                ruta += file.FileName;
                file.SaveAs(ruta);
                imagen = file.FileName.Substring(0, file.FileName.Length);

                evento.imagen = imagen;
            }
            catch (Exception ex) {
                imagen = evento.imagen;
            }
            AdminModel model = new AdminModel();

            model.AddEvento(evento, imagen);
            return(RedirectToAction("Index", "AdminEven"));
        }