Ejemplo n.º 1
0
        public ActionResult New(string id)
        {
            var mdoel = new DictIndexViewModel
            {
                ParentID = id,
            };

            return(View(mdoel));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(DictIndexViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var result = _dictIndexService.Update(model);

            return(RedirectToAction("Index", "Result", new { state = result, style = "dialog" }));
        }
Ejemplo n.º 3
0
        public bool Add(DictIndexViewModel model)
        {
            model.Id = Guid.NewGuid().ToString();
            DictIndex entity = new DictIndex();

            uow.Set <DictIndex>().Add(entity);
            entity.Id     = model.Id;
            entity.Name   = model.Name;
            entity.No     = model.No;
            entity.Parent = uow.Set <DictIndex>().Find(model.ParentID);
            uow.Commit();
            return(true);
        }
Ejemplo n.º 4
0
        public bool Update(DictIndexViewModel model)
        {
            var entity = uow.Set <DictIndex>().Find(model.Id);

            if (entity == null)
            {
                return(false);
            }

            entity.Name   = model.Name;
            entity.No     = model.No;
            entity.Parent = uow.Set <DictIndex>().Find(model.ParentID);
            uow.Commit();
            return(true);
        }
Ejemplo n.º 5
0
        public ActionResult Delete(DictIndexViewModel model)
        {
            var result = _dictIndexService.Delete(model.Id);

            return(RedirectToAction("Index", "Result", new { state = result, style = "dialog" }));
        }