public async Task <IActionResult> CreateTeacher() { var jwtToken = HttpContext.Session.GetString("Token"); //TeacherRoles teacherRoles = new TeacherRoles(); var apiResponse = await httpClientConfig.ApiGetResponse("Teacher/teacherRoles", jwtToken); var res = JObject.Parse(apiResponse); TeacherCreateRequestModel request = new TeacherCreateRequestModel(); request.teacherRole = JsonConvert.DeserializeObject <List <TeacherRoles> >(res["data"].ToString()); return(View(request)); }
public async Task <IActionResult> CreateTeacher(TeacherCreateRequestModel model) { TeacherCreateResponseModel response = new TeacherCreateResponseModel(); var apiResponse = await httpClientConfig.ApiPostResponse("Facilitator/login", model, ""); response = JsonConvert.DeserializeObject <TeacherCreateResponseModel>(apiResponse); if (response.StatusCode == 200) { TempData["alert"] = "alert-success"; ViewBag.Message = "Registered successfully."; return(View(model)); } else { TempData["alert"] = "alert-danger"; ViewBag.Message = response.StatusMessage; return(View()); } }