Ejemplo n.º 1
0
        public void ActionServiceMustGet()
        {
            var service = new ActionService(this.context);
            var result  = service.Get();

            Assert.NotNull(result);
        }
Ejemplo n.º 2
0
        public void GetAction_SomeName_SomeHost()
        {
            var target = new ActionService(_context) as IActionService;

            var result = target.Get();

            Assert.AreEqual(5, result.Count());
        }
Ejemplo n.º 3
0
        public void GetHost_SomeName_SomeHost()
        {
            var data = JsonConvert.DeserializeObject <Entities.Action[]>(File.ReadAllText(_actionGet), _settings);

            _context.Stub(x => x.SendRequest <Entities.Action[]>(Arg <object> .Is.Anything, Arg <string> .Is.Anything)).Return(data);

            var target = new ActionService(_context) as IActionService;

            var result = target.Get();

            Assert.AreEqual(5, result.Count());
        }
        public void GetHost_SomeName_SomeHost()
        {
            var data = JsonConvert.DeserializeObject<Entities.Action[]>(File.ReadAllText(_actionGet), _settings);

            _context.Stub(x => x.SendRequest<Entities.Action[]>(Arg<object>.Is.Anything, Arg<string>.Is.Anything)).Return(data);

            var target = new ActionService(_context) as IActionService;

            var result = target.Get();

            Assert.AreEqual(5, result.Count());
        }
Ejemplo n.º 5
0
        public ActionResult PermModify(string menuId)
        {
            var menu  = actionService.Get(m => m.ActionId == menuId);
            var pList = permissionRepository.ToList(p => p.SystemId == menu.SystemId);
            var url   = menu.Url;

            if (url.Count(c => c == '/') > 2)
            {
                url = url.TrimStart('/');
                url = url.Substring(url.IndexOf("/"), url.Length - url.IndexOf("/"));
            }
            var controller = url.Count(c => c == '/') == 2 ? url.Substring(url.IndexOf("/") + 1, url.TrimStart('/').IndexOf("/")) : url.Substring(url.IndexOf("/") + 1, url.Length - 1);

            var permCodes    = pList.Where(c => c.Controller == controller).Select(c => new KeyValuePair <int, string>(c.PermCode, c.PermName)).ToList();
            var oldPermCodes = actionService.GetActionPerms(menuId);

            ViewData["PermCodes"]      = permCodes;
            ViewData["MenuId"]         = menuId;
            ViewData["OldPermCodes"]   = oldPermCodes;
            ViewData["OtherPermCodes"] = pList.Where(c => c.Controller != controller).OrderBy(c => c.Controller).ToList();
            return(View());
        }
        // GET: Action/Edit/5
        public ActionResult Edit(int id)
        {
            var action = _actionService.Get(id).Result;

            return(View(action));
        }