Пример #1
0
        public async Task <IActionResult> CreateSchool(SchoolSignUpRequestModel model)
        {
            SchoolSignUpResponseModel response = new SchoolSignUpResponseModel();
            var apiResponse = await httpClientConfig.ApiPostResponse("​School​/schoolSignUp", model, "");

            response = JsonConvert.DeserializeObject <SchoolSignUpResponseModel>(apiResponse);
            if (response.StatusCode == 200)
            {
                TempData["alert"] = "alert-success";
                ViewBag.Message   = "Registered successfully.";
                // return RedirectToAction("index", "superAdmin");
            }
            else
            {
                TempData["alert"] = "alert-danger";
                ViewBag.Message   = response.StatusMessage;
                return(View());
            }
            return(View(model));
        }
        public async Task <IActionResult> CreateSchool(SchoolSignUpRequestModel model)
        {
            SchoolSignUpResponseModel response = new SchoolSignUpResponseModel();
            var apiResponse = await httpClientConfig.ApiPostResponse("​School/schoolSignUp", model, "");

            response = JsonConvert.DeserializeObject <SchoolSignUpResponseModel>(apiResponse);

            if (response.StatusCode == 200)
            {
                var jwtToken = response.Token;

                //set the token session
                HttpContext.Session.SetString("Token", jwtToken);
                // HttpContext.Session.SetString("UserEmail", userEmail);

                return(RedirectToAction("ActivateSchool", "Learner"));
            }
            else
            {
                TempData["alert"] = "alert-danger";
                ViewBag.Message   = response.StatusMessage;
                return(View());
            }
        }