Ejemplo n.º 1
0
        //反填
        public ActionResult WithsEdit(Guid ID)
        {
            string sql = $"select * from Withs where ID='{ID}'";
            Withs  s   = DBHelper.Get <Withs>(sql);

            return(View(s));
        }
Ejemplo n.º 2
0
        //修改方法
        public ActionResult WithsEdits(Withs withs, HttpPostedFileBase file)
        {
            //上传图片,保存到本地img
            string filename = Path.GetFileName(file.FileName);
            string path     = Request.MapPath("/img/");
            string fullname = Path.Combine(path, filename);

            file.SaveAs(fullname);
            withs.WImg = filename;
            string sql = $"update Withs set WName='{withs.WName}',WNative='{withs.WNative}',WIdentity='{withs.WIdentity}',WPhone='{withs.WPhone}',WSite='{withs.WSite}',WRemark='{withs.WRemark}' ,WImg ='{withs.WImg}'where ID='{withs.ID}'";

            DBHelper.ExecuteNonQuery(sql);
            return(RedirectToAction("WithsIndex"));
        }
Ejemplo n.º 3
0
        public ActionResult WithsCreates(Withs withs, HttpPostedFileBase file)
        {
            //上传图片,保存到本地img
            string filename = Path.GetFileName(file.FileName);
            string path     = Request.MapPath("/img/");
            string fullname = Path.Combine(path, filename);

            file.SaveAs(fullname);
            withs.WImg = filename;
            string sql = $"insert into Withs(WName,WNative,WIdentity,WPhone,WSite,WRemark,WImg) values('{withs.WName}','{withs.WNative}','{withs.WIdentity}','{withs.WPhone}','{withs.WSite}','{withs.WRemark}','{withs.WImg}')";

            DBHelper.ExecuteNonQuery(sql);
            return(RedirectToAction("WithsIndex"));
        }