• 大小: 7KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-14
  • 语言: 其他
  • 标签: .net  MVC  Html  

资源简介

简单的数据提交,通过Models类传输数据,生成个人简历,简单代码 ,仅供学

资源截图

代码片段和文件信息


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebApplication1.Controllers
{
    public class HtmlController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }

        // GET: Home/Details/5
        public ActionResult GetData(String username String[] like String photo String mydate String tel
            String pac String native String school String myemail String age String academic String name
             String qiuzhiyixiang String[] yuyanlei String[] ruanjianlei String[] rongyulei)
        {
            ViewBag.username = username;
            ViewBag.like = like;
            ViewBag.photo = Request.Files[“photo“].FileName;
            ViewBag.mydate = mydate;
            ViewBag.tel = tel;
            ViewBag.pac = pac;
            ViewBag.native = native;
            ViewBag.school = school;
            ViewBag.myemail = myemail;
            ViewBag.age = age;
            ViewBag.academic = academic;
            ViewBag.name = name;
            ViewBag.qiuzhiyixiang = qiuzhiyixiang;
            ViewBag.yuyanlei = yuyanlei;
            ViewBag.ruanjianlei = ruanjianlei;
            ViewBag.rongyulei = rongyulei;
            Upload();
            return View();
        }

        // GET: Home/Create
        public ActionResult Upload()
        {
            HttpPostedFilebase file = Request.Files[“photo“];
            if (file == null) return Content(“上传失败“);
            var fileName = Path.Combine(Request.MapPath(“/images“)
                Path.GetFileName(file.FileName));
            try
            {
                file.SaveAs(fileName);
                return Content(“上传成功“);

            }
            catch
            {
                return Content(“上传失败“);
            }
            // return View();
        }

   
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-11-01 10:56  个人简历\
     目录           0  2018-11-01 10:55  个人简历\Controllers\
     文件        2039  2018-09-26 21:49  个人简历\Controllers\HtmlController.cs
     目录           0  2018-11-01 10:56  个人简历\Models\
     文件         854  2018-10-11 00:58  个人简历\Models\Person.cs
     目录           0  2018-11-01 10:58  个人简历\Views\
     目录           0  2018-11-01 10:56  个人简历\Views\Html\
     文件        4344  2018-09-26 22:15  个人简历\Views\Html\GetData.cshtml
     文件        6964  2018-09-26 21:53  个人简历\Views\Html\Index.cshtml
     目录           0  2018-11-01 10:58  个人简历\Views\Shared\
     文件         333  2018-09-26 21:37  个人简历\Views\Shared\Error.cshtml
     文件        1708  2018-10-28 11:00  个人简历\Views\Shared\_Layout.cshtml

评论

共有 条评论