コード例 #1
0
        public IActionResult Add()
        {
            SchoolUserCategoryDetailViewModel schoolUserCategoryDetailViewModel = new SchoolUserCategoryDetailViewModel
            {
            };

            return(View(schoolUserCategoryDetailViewModel));
        }
コード例 #2
0
        public async Task <IActionResult> Add(SchoolUserCategoryDetailViewModel schoolUserCategoryDetailViewModel)
        {
            string fullLink = $"{baseUri}/SchoolUserCategory";

            SchoolUserCategory schoolUserCategory = new SchoolUserCategory
            {
                Category = schoolUserCategoryDetailViewModel.Category
            };

            await WebApiService.PostCallApi <SchoolUserCategory, SchoolUserCategory>(fullLink, schoolUserCategory);

            return(RedirectToAction("Index", "UserCategory"));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(SchoolUserCategoryDetailViewModel schoolUserCategoryDetailViewModel)
        {
            string fullLink = $"{baseUri}/SchoolUserCategory";

            string             schoolUserCategoryById = fullLink + "/" + schoolUserCategoryDetailViewModel.Id;
            SchoolUserCategory schoolUserCategory     = WebApiService.GetApiResult <SchoolUserCategory>(schoolUserCategoryById);

            schoolUserCategory.Category = schoolUserCategoryDetailViewModel.Category;

            string updateLink = $"{baseUri}/SchoolUserCategory/{schoolUserCategory.Id}";
            await WebApiService.PutCallApi <SchoolUserCategory, SchoolUserCategory>(updateLink, schoolUserCategory);

            return(RedirectToAction("Index", "UserCategory"));
        }
コード例 #4
0
        public IActionResult Edit(int id)
        {
            string fullLink = $"{baseUri}/SchoolUserCategory";

            string             schoolUserCategoryById = fullLink + "/" + id;
            SchoolUserCategory schoolUserCategory     = WebApiService.GetApiResult <SchoolUserCategory>(schoolUserCategoryById);

            SchoolUserCategoryDetailViewModel schoolUserCategoryDetailViewModel = new SchoolUserCategoryDetailViewModel
            {
                Category = schoolUserCategory.Category
            };

            return(View(schoolUserCategoryDetailViewModel));
        }
コード例 #5
0
        public IActionResult Details(int id)
        {
            string fullLink     = $"{baseUri}/SchoolUserCategory/{id}";
            string userLink     = $"{baseUri}/SchoolUser";
            var    userCategory = WebApiService.GetApiResult <SchoolUserCategory>(fullLink);
            var    users        = WebApiService.GetApiResult <List <SchoolUser> >(userLink);

            SchoolUserCategoryDetailViewModel detailVm = new SchoolUserCategoryDetailViewModel
            {
                Id          = userCategory.Id,
                Category    = userCategory.Category,
                SchoolUsers = users
            };

            return(View(detailVm));
        }