public async Task <IActionResult> Edit(int id, [Bind("WebinarModelID,JudulWebinar,Deskripsi,Tanggal,Platform,GambarUrl,PembicaraModelID")] WebinarModel webinarModel) { if (id != webinarModel.WebinarModelID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(webinarModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WebinarModelExists(webinarModel.WebinarModelID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PembicaraModelID"] = new SelectList(_context.PembicaraModels, "ID", "NamaBelakang", webinarModel.PembicaraModelID); return(View(webinarModel)); }
public ActionResult Index() { WebinarModel model = new WebinarModel(); model.Title = this.Title; model.Description = this.Description; model.Start = this.Start; model.End = this.End; return(View(model)); }
public async Task <IActionResult> Create([Bind("WebinarModelID,JudulWebinar,Deskripsi,Tanggal,Platform,GambarUrl,PembicaraModelID")] WebinarModel webinarModel) { if (ModelState.IsValid) { _context.Add(webinarModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["PembicaraModelID"] = new SelectList(_context.PembicaraModels, "ID", "NamaBelakang", webinarModel.PembicaraModelID); return(View(webinarModel)); }
public ActionResult WebinarLogin() { logMessage = new StringBuilder(); try { logMessage.AppendLine(string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); objDecisionPointEngine = new DecisionPointEngine(); // IList<WebinarUsersResponse> userList = objDecisionPointEngine.GetWebinarOrganiser(Convert.ToInt32(Session["UserId"], CultureInfo.InvariantCulture)); IList <WebinarUsersResponse> userList = objDecisionPointEngine.GetWebinarOrganiser(1);// for super admin credentails fixed temprorary if (userList != null && userList.Count > 0) { objWebinarModel = new WebinarModel() { Id = userList[0].Id, UserId = userList[0].UserId, emailId = userList[0].UserName, apiKey = userList[0].AppKey, password = userList[0].Password, OrganiserId = userList[0].OrganiserId, }; return(WebinarLogin(objWebinarModel)); } else { return(View()); } } catch (Exception ex) { log.ErrorFormat("Error : {0}\n By : {1}-{2}", ex.ToString(), typeof(LoginController).Name, MethodBase.GetCurrentMethod().Name); return(RedirectToAction("Error", "Login", new { errorMsg = ex.ToString() })); } finally { logMessage.AppendLine(string.Format(CultureInfo.InvariantCulture, "End {0} function.", MethodBase.GetCurrentMethod().Name)); log.Info(logMessage.ToString()); } }
public ActionResult WebinarLogin(WebinarModel webinarModel) { // first we need to create the uri for the web request string uri = String.Format("https://api.citrixonline.com/oauth/access_token?grant_type=password&user_id={0}&password={1}&client_id={2}", webinarModel.emailId, webinarModel.password, webinarModel.apiKey); // then the request to login is created and sent. From the response // we need to store at least the access token and the organizer key // to use for further calls HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri); request.Accept = "application/json"; request.ContentType = "application/json"; string Result = string.Empty; try { var response = request.GetResponse(); //the following lines duplicate the response stream so we can read it for //deserialization and also re-read it and write it out. using (MemoryStream ms = new MemoryStream()) { var stream = response.GetResponseStream(); stream.CopyTo(ms); ms.Position = 0; stream.Close(); DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(ResponseDirectLogin)); var deserialized = (ResponseDirectLogin)ser.ReadObject(ms); OauthToken = deserialized.AccessToken; OrganizerKey = deserialized.OrganizerKey; ms.Position = 0; using (var sr = new StreamReader(ms)) Result = sr.ReadToEnd(); } if (string.IsNullOrEmpty(webinarModel.OrganiserId)) { objWebinarUsersResponse = new WebinarUsersResponse() { Id = webinarModel.Id, UserName = webinarModel.emailId, Password = webinarModel.password, AppKey = webinarModel.apiKey, OrganiserId = OrganizerKey, UserId = webinarModel.UserId, IsActive = true, }; objDecisionPointEngine = new DecisionPointEngine(); objDecisionPointEngine.setWebinarUserDetails(objWebinarUsersResponse); } } catch (WebException e) { using (var sr = new StreamReader(e.Response.GetResponseStream())) Result = sr.ReadToEnd(); return(RedirectToAction("Error", "Login", new { errorMsg = Result })); } return(RedirectToAction("WebinarDashboard")); }
public ActionResult WebinarDashboard(WebinarModel webinarModel) { return(View()); }