Exemplo n.º 1
0
 public ViewResult Add(iPow.Infrastructure.Crosscutting.Authorize.Dto.MvcControllerDto MvcController, string State)
 {
     //做为 DropDownList DataSource
     ViewBag.Controllermodel = mvcControllerClassService.GetList();
     if (MvcController != null)
     {
         var mvcclass = mvcControllerClassService.GetClassModelById(MvcController.ClassId);
         //MvcController.ClassName = mvcclass.Name;
         //根据Name查询
         var ControllerByName = mvcControllerService.GetList().Where(e => e.Name == MvcController.Name).FirstOrDefault();
         if (ControllerByName == null)
         {
             //判断Controller 是否存在当前所选Role  若没有则创建 有的话 阻止
             var isexist = mvcControllerService.ClassNameAndControllerNameHasController(MvcController.ClassId, MvcController.Name);
             if (isexist)  //该语法表示 已经存在
             {
                 ModelState.AddModelError("", "该该控制器已经存在同一分类!");
             }
             else
             {
                 iPow.Infrastructure.Data.DataSys.Sys_MvcController addController = new iPow.Infrastructure.Data.DataSys.Sys_MvcController();
                 addController.ClassId          = MvcController.ClassId;
                 addController.Name             = MvcController.Name;
                 addController.AssemblyFullName = addController.Name;
                 addController.Remark           = addController.Name;
                 MvcController.AddTime          = System.DateTime.Now;
                 addController.AddTime          = MvcController.AddTime;
                 addController.IpAddress        = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                 addController.State            = Convert.ToBoolean(State);
                 addController.SortNum          = MvcController.SortNum;
                 mvcControllerService.Add(addController, null);
                 if (addController.Id > 0)
                 {
                     ModelState.AddModelError("", "恭喜,亲彻底Hold住了");
                 }
                 else
                 {
                     ModelState.AddModelError("", "败笔!亲不给力哦~");
                 }
             }
         }
         else
         {
             ModelState.AddModelError("", "添加控制器失败 ");
         }
     }
     else
     {
         ModelState.AddModelError("", "亲请使用楷体字用力填写");
     }
     return(View(MvcController));
 }
Exemplo n.º 2
0
        public bool Modify(iPow.Infrastructure.Data.DataSys.Sys_MvcController entity, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;

            if (entity != null && entity.Id > 0)
            {
                try
                {
                    controllerRepository.Modify(entity);
                    res = true;
                }
                catch (Exception ex)
                {
                }
            }
            return(res);
        }
Exemplo n.º 3
0
        public bool Add(iPow.Infrastructure.Data.DataSys.Sys_MvcController entity, iPow.Infrastructure.Data.DataSys.Sys_AdminUser operUser)
        {
            var res = false;

            if (entity != null)
            {
                try
                {
                    controllerRepository.Add(entity);
                    controllerRepository.Uow.Commit();
                    res = true;
                }
                catch (Exception ex)
                {
                }
            }
            return(res);
        }
Exemplo n.º 4
0
 public void Modify(iPow.Infrastructure.Data.DataSys.Sys_MvcController controller)
 {
     controllerRepository.Modify(controller);
     controllerRepository.Uow.Commit();
 }
Exemplo n.º 5
0
 public ViewResult Add(iPow.Infrastructure.Crosscutting.Authorize.Dto.MvcControllerDto MvcController, string State)
 {
     //做为 DropDownList DataSource
     ViewBag.Controllermodel = mvcControllerClassService.GetList();
     if (MvcController != null)
     {
         var mvcclass = mvcControllerClassService.GetClassModelById(MvcController.ClassId);
         //MvcController.ClassName = mvcclass.Name;
         //根据Name查询
         var ControllerByName = mvcControllerService.GetList().Where(e => e.Name == MvcController.Name).FirstOrDefault();
         if (ControllerByName == null)
         {
             //判断Controller 是否存在当前所选Role  若没有则创建 有的话 阻止
             var isexist = mvcControllerService.ClassNameAndControllerNameHasController(MvcController.ClassId, MvcController.Name);
             if (isexist)  //该语法表示 已经存在
             {
                 ModelState.AddModelError("", "该该控制器已经存在同一分类!");
             }
             else
             {
                 iPow.Infrastructure.Data.DataSys.Sys_MvcController addController = new iPow.Infrastructure.Data.DataSys.Sys_MvcController();
                 addController.ClassId = MvcController.ClassId;
                 addController.Name = MvcController.Name;
                 addController.AssemblyFullName = addController.Name;
                 addController.Remark = addController.Name;
                 MvcController.AddTime = System.DateTime.Now;
                 addController.AddTime = MvcController.AddTime;
                 addController.IpAddress = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                 addController.State = Convert.ToBoolean(State);
                 addController.SortNum = MvcController.SortNum;
                 mvcControllerService.Add(addController, null);
                 if (addController.Id > 0)
                 {
                     ModelState.AddModelError("", "恭喜,亲彻底Hold住了");
                 }
                 else
                 {
                     ModelState.AddModelError("", "败笔!亲不给力哦~");
                 }
             }
         }
         else
         {
             ModelState.AddModelError("", "添加控制器失败 ");
         }
     }
     else
     {
         ModelState.AddModelError("", "亲请使用楷体字用力填写");
     }
     return View(MvcController);
 }