Exemple #1
0
 public void Create(ModuleDto model)
 {
     if (!string.IsNullOrEmpty(model.LinkUrl) && model.LinkUrl.Split('/').Length == 3)
     {
         string[] link = model.LinkUrl.Split('/');
         model.Area       = link[0];
         model.Controller = link[1];
         model.Action     = link[2];
     }
     model.Enabled = false;
     _moduleRepository.Insert(model.MapTo <Module>());
 }
 public void Update(ModuleDto model)
 {
     if (!string.IsNullOrEmpty(model.LinkUrl) && model.LinkUrl.Split('/').Length == 3)
     {
         string[] link = model.LinkUrl.Split('/');
         model.Area = link[0];
         model.Controller = link[1];
         model.Action = link[2];
     }
     var entity = _moduleRepository.GetById(model.Id);
     _moduleRepository.Update(model.MapTo(entity));
 }
 public void Create(ModuleDto model)
 {
     if (!string.IsNullOrEmpty(model.LinkUrl) && model.LinkUrl.Split('/').Length == 3)
     {
         string[] link = model.LinkUrl.Split('/');
         model.Area = link[0];
         model.Controller = link[1];
         model.Action = link[2];
     }
     model.Enabled = false;
     _moduleRepository.Insert(model.MapTo<Module>());
 }
Exemple #4
0
        public void Update(ModuleDto model)
        {
            if (!string.IsNullOrEmpty(model.LinkUrl) && model.LinkUrl.Split('/').Length == 3)
            {
                string[] link = model.LinkUrl.Split('/');
                model.Area       = link[0];
                model.Controller = link[1];
                model.Action     = link[2];
            }
            var entity = _moduleRepository.GetById(model.Id);

            _moduleRepository.Update(model.MapTo(entity));
        }
 public ActionResult Edit(int? id)
 {
     ModuleDto model = null;
     ViewBag.ParentModuleList = _moduleService.GetParentModuleList();
     if (!id.HasValue)  //新建
     {
         model = new ModuleDto();
     }
     else  //编辑
     {
         model = _moduleService.GetById(id.Value);
     }
     return View(model);
 }
 public JsonResult CreateOrUpdate(ModuleDto model)
 {
     if (model.Id == 0)
     {
         this.Create(model);
     }
     else
     {
         this.Update(model);
     }
     return Json(1, JsonRequestBehavior.AllowGet);
 }
        public JsonResult Update(ModuleDto model)
        {
            _moduleService.Update(model);
            return Json(1, JsonRequestBehavior.AllowGet);

        }