public async Task <IActionResult> Auth(string username, string password)
        {
            var data = await HttpClientAsync.Async(AuthenticationRoute.Auth, new { username, password });

            data.isSuccess = true;
            return(this.Json(data));
        }
Пример #2
0
        public async Task TestGetWithMultipleParameterAsync()
        {
            dynamic model = await HttpClientAsync.Async(AuthenticationRoute.Auth, "admin", "111111");

            int code = model.code;

            Assert.AreEqual(code, (int)HttpStatusCode.OK);
        }
Пример #3
0
        /// <summary>
        /// The index page.
        /// </summary>
        /// <returns>A IActionResult.</returns>
        public async Task <IActionResult> Index()
        {
            var response = await HttpClientAsync.Async <IList <MenuModel> >(MenuRoute.Index);

            MenuIndex <MenuModel, MenuPostModel> index = new MenuIndex <MenuModel, MenuPostModel>(response);

            return(this.SearchGridConfiguration(index));
        }
Пример #4
0
        public async Task <IActionResult> GridStateChange(UserPostModel model)
        {
            HttpResponseModel response = await HttpClientAsync.Async <IList <UserModel> >(UserRoute.Search, model);

            UserViewConfiguration <UserModel> configuration = new UserViewConfiguration <UserModel>(response);

            return(this.GridConfiguration(configuration));
        }
        public async Task <IActionResult> MenuDataList(string name)
        {
            HttpResponseModel model = await HttpClientAsync.Async <IList <MenuModel> >(DataListRoute.GetMenuDataList, name);

            IList <MenuModel> users = (IList <MenuModel>)model.Data;

            return(this.DataListContent(users, o => o.Id, o => o.Name));
        }
Пример #6
0
        public async Task <IActionResult> EditDialog(int id)
        {
            HttpResponseModel model = await HttpClientAsync.Async <UserModel>(UserRoute.FindById, id);

            EditUserDialogConfiguration <UserEditPostModel, UserModel> dialog = new EditUserDialogConfiguration <UserEditPostModel, UserModel>((UserModel)model.Data);

            return(this.Dialog(dialog));
        }
Пример #7
0
        /// <summary>
        /// The Index.
        /// </summary>
        /// <returns>A IActionResult.</returns>
        public async Task <IActionResult> Index()
        {
            var model = await HttpClientAsync.Async <IList <RoleModel> >(RoleRoute.Index);

            RoleIndex <RoleModel, RolePostModel> table = new RoleIndex <RoleModel, RolePostModel>(model);

            return(this.SearchGridConfiguration(table));
        }
Пример #8
0
        public async Task <IActionResult> GridStateChange(IconPostModel model)
        {
            var response = await HttpClientAsync.Async <IList <Icon> >(IconRoute.Search, model);

            IconGridConfiguration configuration = new IconGridConfiguration(response);

            return(GridConfiguration(configuration));
        }
Пример #9
0
        public async Task <IActionResult> GridStateChange(LogPostModel model)
        {
            HttpResponseModel response = await HttpClientAsync.Async <IList <LogModel> >(LogRoute.Search, model);

            LogGridConfiguration <LogModel> configuration = new LogGridConfiguration <LogModel>(response);

            return(this.GridConfiguration(configuration));
        }
Пример #10
0
        public async Task <IActionResult> GridStateChange(PermissionPostModel model)
        {
            HttpResponseModel response = await HttpClientAsync.Async <IList <Permission> >(PermissionRoute.Search, model);

            PermissionGridConfiguration configuration = new PermissionGridConfiguration(response);

            return(this.GridConfiguration(configuration));
        }
Пример #11
0
        /// <summary>
        /// The Index.
        /// </summary>
        /// <returns>A IActionResult.</returns>
        public async Task <IActionResult> Index()
        {
            var model = await HttpClientAsync.Async <IList <LogModel> >(LogRoute.Index);

            LogIndex <LogModel, LogPostModel> table = new LogIndex <LogModel, LogPostModel>(model);

            return(this.SearchGridConfiguration(table));
        }
Пример #12
0
        public async Task <IActionResult> Index()
        {
            var model = await HttpClientAsync.Async <IList <UserModel> >(UserRoute.Index, this.Authentication);

            UserIndex <UserModel, UserPostModel> table = new UserIndex <UserModel, UserPostModel>(model);

            return(this.SearchGridConfiguration(table));
        }
Пример #13
0
        /// <summary>
        /// The Index.
        /// </summary>
        /// <returns>A IActionResult.</returns>
        public async Task <IActionResult> Index()
        {
            var model = await HttpClientAsync.Async <IList <Permission> >(PermissionRoute.Index);

            PermissionIndex table = new PermissionIndex(model);

            return(this.SearchGridConfiguration(table));
        }
        public async Task <IActionResult> RoleDataList(string name)
        {
            HttpResponseModel model = await HttpClientAsync.Async <IList <Role> >(DataListRoute.GetRoleDataList, name);

            IList <Role> roles = (IList <Role>)model.Data;

            return(this.DataListContent(roles, o => o.Id, o => o.Name));
        }
Пример #15
0
        public async Task TestGetTokenWithDynamicObject()
        {
            var data = await HttpClientAsync.Async(AuthenticationRoute.Auth, new { username = "******", password = "******" });

            int code = data.code;

            Assert.AreEqual(code, (int)HttpStatusCode.OK);
        }
Пример #16
0
        /// <summary>
        /// The index page.
        /// </summary>
        /// <returns>A IActionResult.</returns>
        public async Task <IActionResult> Index()
        {
            var responseModel = await HttpClientAsync.Async <IList <Icon> >(IconRoute.Index);

            IconIndex <IconPostModel> index = new IconIndex <IconPostModel>(responseModel);

            return(SearchGridConfiguration(index));
        }
Пример #17
0
        public async Task <IActionResult> GridStateChange(RolePostModel model)
        {
            var response = await HttpClientAsync.Async <IList <RoleModel> >(RoleRoute.Search, model);

            RoleViewConfiguration <RoleModel> configuration = new RoleViewConfiguration <RoleModel>(response);

            return(this.GridConfiguration(configuration));
        }
Пример #18
0
        public async Task <IActionResult> EditDialog(int id)
        {
            HttpResponseModel model = await HttpClientAsync.Async <RoleModel>(RoleRoute.FindById, id);

            RoleModel user = (RoleModel)model.Data;
            EditRoleDialogConfiguration <RoleEditPostModel, RoleModel> dialog = new EditRoleDialogConfiguration <RoleEditPostModel, RoleModel>(user);

            return(this.Dialog(dialog));
        }
Пример #19
0
        public async Task <IActionResult> EditDialog(int id)
        {
            HttpResponseModel model = await HttpClientAsync.Async <MenuModel>(MenuRoute.FindById, id);

            MenuModel menuModel = (MenuModel)model.Data;
            EditMenuDialogConfiguration <MenuEditPostModel, MenuModel> dialog = new EditMenuDialogConfiguration <MenuEditPostModel, MenuModel>(menuModel);

            return(this.Dialog(dialog));
        }
Пример #20
0
        public async Task TestUserIndexAsync()
        {
            HttpResponseModel model = await HttpClientAsync.Async <IList <UserModel> >(UserRoute.Index, this.authentication);

            IList <UserModel> menus = (IList <UserModel>)model.Data;

            Assert.GreaterOrEqual(menus.Count, 0);
            Assert.AreEqual(model.Code, (int)HttpStatusCode.OK);
        }
Пример #21
0
        public async Task TestUnAuthenticate()
        {
            using (HttpClient client = HttpClientAsync.CreateInstance())
            {
                HttpResponseMessage response = await client.GetAsync(TestRoute.TestAuthentication);

                Assert.AreEqual(response.StatusCode, HttpStatusCode.Unauthorized);
            }
        }
Пример #22
0
        public async Task TestAuthentication()
        {
            dynamic data = await HttpClientAsync.Async(TestRoute.TestAuthentication, this.authentication);

            Console.WriteLine(data);
            bool isAuthenticated = data.isAuthenticated;

            Assert.IsTrue(isAuthenticated);
        }
Пример #23
0
        public async Task TestRoleFindByIdAsync()
        {
            HttpResponseModel model = await HttpClientAsync.Async <RoleModel>(RoleRoute.FindById, 1);

            RoleModel user = (RoleModel)model.Data;

            Assert.IsNotNull(user);
            Assert.AreEqual(model.Code, (int)HttpStatusCode.OK);
        }
Пример #24
0
        public async Task TestLogIndexAsync()
        {
            HttpResponseModel model = await HttpClientAsync.Async <IList <LogModel> >(LogRoute.Index);

            IList <LogModel> menus = (IList <LogModel>)model.Data;

            Assert.GreaterOrEqual(menus.Count, 0);
            Assert.AreEqual(model.Code, (int)HttpStatusCode.OK);
        }
Пример #25
0
        public async Task <IActionResult> RowContextMenu(int id)
        {
            HttpResponseModel model = await HttpClientAsync.Async <RoleModel>(RoleRoute.FindById, data : id);

            RoleModel          user = (RoleModel)model.Data;
            RoleRowContextMenu menu = new RoleRowContextMenu(user);

            return(this.Content(menu.Render(), "text/html", Encoding.UTF8));
        }
Пример #26
0
        public async Task TestPostWithParameterAsync()
        {
            HttpResponseModel model = await HttpClientAsync.Async <IList <LogModel> >(LogRoute.Search, new LogPostModel()
            {
                PageSize = 10, PageIndex = 1
            });

            Assert.AreEqual(model.Code, (int)HttpStatusCode.OK);
        }
Пример #27
0
        public async Task TestGetMenuDataListAsync()
        {
            HttpResponseModel model = await HttpClientAsync.Async <IList <MenuModel> >(DataListRoute.GetMenuDataList);

            IList <MenuModel> menus = (IList <MenuModel>)model.Data;

            Assert.GreaterOrEqual(menus.Count, 0);
            Assert.AreEqual(model.Code, (int)HttpStatusCode.OK, UnitTestResource.TestGetMenuDataList);
        }
Пример #28
0
        public async Task <IActionResult> RowContextMenu(int id)
        {
            HttpResponseModel model = await HttpClientAsync.Async <MenuModel>(MenuRoute.FindById, id);

            MenuModel          menuModel = (MenuModel)model.Data;
            MenuRowContextMenu menu      = new MenuRowContextMenu(menuModel);

            return(this.Content(menu.Render(), "text/html", Encoding.UTF8));
        }
Пример #29
0
        public static async Task <T> ShowAllServicesAsync <T>()
        {
            var routeInfo = new RouteInfo
            {
                HttpMethods = "GET",
                Path        = ShowAllServices,
            };

            return(await HttpClientAsync.Async <T>(routeInfo));
        }
Пример #30
0
        public static async Task <T> Get_0_Constraint_0_ParamerterAsync <T>()
        {
            var routeInfo = new RouteInfo
            {
                HttpMethods = "GET",
                Path        = Get_0_Constraint_0_Paramerter,
            };

            return(await HttpClientAsync.Async <T>(routeInfo));
        }