Exemplo n.º 1
0
        //
        // GET: /Unit/
        public ActionResult Details(string id)
        {
            var model     = unitSer.Find(id);
            var viewModel = new UnitView();

            viewModel.CopyFrom(model);
            return(View(viewModel));
        }
Exemplo n.º 2
0
        //修改层信息
        public ActionResult EditUnit(string id)
        {
            var model = new UnitView();
            var m     = unitSer.FirstOrDefault(x => x.U_ID == id);

            model.CopyFrom(m);
            return(View(model));
        }
Exemplo n.º 3
0
        //添加层信息
        public ActionResult AddUnit(UnitView model)
        {
            if (!ModelState.IsValid)
            {
                return(WriteStatusError(ModelState));
            }
            Unit modelUnit = new Unit();

            model.CopyFrom(model);
            unitSer.Add(modelUnit);
            modelUnit.U_ID = Guid.NewGuid().ToString();
            unitSer.SaveChanges();
            return(WriteSuccess("添加成功"));
        }