예제 #1
0
        public ActionResult Update()
        {
            string id        = Request["id"] ?? "";
            string bianhao   = Request["bianhao"] ?? "";
            string mingcheng = Request["mingcheng"] ?? "";
            string miaoshu   = Request["miaoshu"] ?? "";
            string col1      = Request["col1"] ?? "";
            string makedate  = Request["makedate"] ?? "";
            string makeman   = Request["makeman"] ?? "";
            int    uid       = int.Parse(id);

            try
            {
                base_huobi p = ob_base_huobiservice.GetEntityById(base_huobi => base_huobi.ID == uid);
                p.Bianhao   = bianhao.Trim();
                p.Mingcheng = mingcheng.Trim();
                p.Miaoshu   = miaoshu.Trim();
                p.Col1      = col1.Trim();
                p.MakeDate  = makedate == "" ? DateTime.Now : DateTime.Parse(makedate);
                p.MakeMan   = makeman == "" ? 0 : int.Parse(makeman);
                ob_base_huobiservice.UpdateEntity(p);
                ViewBag.saveok = ViewAddTag.ModifyOk;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                ViewBag.saveok = ViewAddTag.ModifyNo;
            }
            return(RedirectToAction("Edit", new { id = uid }));
        }
예제 #2
0
        public ActionResult Save()
        {
            string id        = Request["id"] ?? "";
            string bianhao   = Request["bianhao"] ?? "";
            string mingcheng = Request["mingcheng"] ?? "";
            string miaoshu   = Request["miaoshu"] ?? "";
            string col1      = Request["col1"] ?? "";
            string makedate  = Request["makedate"] ?? "";
            string makeman   = Request["makeman"] ?? "";

            try
            {
                base_huobi ob_base_huobi = new base_huobi();
                ob_base_huobi.Bianhao   = bianhao.Trim();
                ob_base_huobi.Mingcheng = mingcheng.Trim();
                ob_base_huobi.Miaoshu   = miaoshu.Trim();
                ob_base_huobi.Col1      = col1.Trim();
                ob_base_huobi.MakeDate  = makedate == "" ? DateTime.Now : DateTime.Parse(makedate);
                ob_base_huobi.MakeMan   = makeman == "" ? 0 : int.Parse(makeman);
                ob_base_huobi           = ob_base_huobiservice.AddEntity(ob_base_huobi);
                ViewBag.base_huobi      = ob_base_huobi;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(RedirectToAction("Index"));
        }
예제 #3
0
        public ActionResult Edit(int id)
        {
            base_huobi tempData = ob_base_huobiservice.GetEntityById(base_huobi => base_huobi.ID == id && base_huobi.IsDelete == false);

            ViewBag.base_huobi = tempData;
            if (tempData == null)
            {
                return(View());
            }
            else
            {
                base_huobiViewModel base_huobiviewmodel = new base_huobiViewModel();
                base_huobiviewmodel.ID        = tempData.ID;
                base_huobiviewmodel.Bianhao   = tempData.Bianhao;
                base_huobiviewmodel.Mingcheng = tempData.Mingcheng;
                base_huobiviewmodel.Miaoshu   = tempData.Miaoshu;
                base_huobiviewmodel.Col1      = tempData.Col1;
                base_huobiviewmodel.MakeDate  = tempData.MakeDate;
                base_huobiviewmodel.MakeMan   = tempData.MakeMan;
                return(View(base_huobiviewmodel));
            }
        }