public int Edit(BuildUnitModel model)
        {
            var ent = model.ToORMEntity <BuildUnit>();
            int re  = dbContext.BuildUnit.Update(ent);

            return(re);
        }
Beispiel #2
0
        public ActionResult BuildUnitAdd(BuildUnitModel model)
        {
            int re = 0;

            if (ModelState.IsValid)
            {
                if (model != null)
                {
                    if (model.BID != Guid.Empty)
                    {
                        re = buildUnit.Edit(model);
                    }
                    else
                    {
                        model.BID = Guid.NewGuid();
                        re        = buildUnit.Add(model);
                    }
                    if (re > 0)
                    {
                        return(AjaxResult(success: re > 0, data: model, ajaxDataTypes: AjaxDataTypes.Json));
                    }
                }
                return(AjaxResult(success: false, data: null, ajaxDataTypes: RTSafe.Platform.Module.Mvc.AjaxDataTypes.Json));
            }
            else
            {
                ModelState.AddModelError("erro", "验证不通过,请检查输入");
            }
            return(PartialView(model));
        }
        public int Add(BuildUnitModel model)
        {
            BuildUnit ent = model.ToORMEntity <BuildUnit>();
            int       re  = dbContext.BuildUnit.Insert(ent);

            return(re);
        }
Beispiel #4
0
        public ActionResult BuildUnitQuery(Guid?id)
        {
            BuildUnitModel model = new BuildUnitModel();

            if (id.HasValue)
            {
                model = buildUnit.Get(id.Value);
            }
            return(View(model));
        }