void Awake() { instance = this; m_fadeImage.color = new Color(0, 0, 0, 1); isStart.onValueChanged.AddListener((bool value) => OnStartGame(value)); m_skipButton.onClick.AddListener(LoadScene); }
public IEnumerable<Lecture> GetByTutor() { string tutorId = User.Identity.GetUserId(); if (tutorId == null) throw new HttpResponseException(HttpStatusCode.NotFound); var tutorManager = new TutorManager<TutorRequestStore, TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); IEnumerable<Lecture> AllLectures = tutorManager.GetAllLecturesByTutorId(tutorId); return AllLectures; }
private void Awake() { if (instance != null) { Debug.LogError("SingleTone Error!"); Destroy(gameObject); return; } instance = this; }
public HttpResponseMessage GetFile(string fileid) { var tutorManager = new TutorManager<TutorRequestStore, TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); var path = tutorManager.GetFilePath(fileid); var namePos = path.LastIndexOf('\\') + 1; var prefileName = path.Substring(namePos); var fileName = ConvertUTF8ToIso(prefileName); if (!File.Exists(path)) throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Can't load file")); var result = new HttpResponseMessage(HttpStatusCode.OK); var stream = new FileStream(path, FileMode.Open); result.Content = new StreamContent(stream); result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment"); result.Content.Headers.ContentDisposition.FileName = fileName; //result.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/odt"); return result; }
public IEnumerable<Lecture> GetByDiscipline() { var tutorManager = new TutorManager<TutorRequestStore, TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); IEnumerable<Lecture> AllLectures = tutorManager.GetAllLectures(); //if (orderby == "bydate") //{ // result = LectureTests // .Where(l => l.Discipline == discipline) // .OrderBy(l => l.Date) // .Skip((page - 1) * itemsperpage) // .Take(itemsperpage); //} //else if (orderby == "bydiscipline") //{ // result = LectureTests // .Where(l => l.Discipline == discipline) // .OrderBy(l => l.Discipline) // .Skip((page - 1) * itemsperpage) // .Take(itemsperpage); //} return AllLectures; }
public void Delete(string lectureId) { var tutorManager = new TutorManager<TutorRequestStore, TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); tutorManager.DeleteLecture(lectureId); }
public async Task<HttpResponseMessage> Put(string lectureId) { if (!Request.Content.IsMimeMultipartContent()) { throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } string root = HttpContext.Current.Server.MapPath("~/App_Data"); var provider = new CustomMultipartFormDataStreamProvider(root); try { await Request.Content.ReadAsMultipartAsync(provider); string pathToFile = provider.FileData.FirstOrDefault()?.LocalFileName; if (pathToFile == null) pathToFile = "NULL"; string subject = provider.FormData["subject"]; string LectureName = provider.FormData["name"]; var tutorManager = new TutorManager<TutorRequestStore, TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); tutorManager.UpdateLecture(new Lecture() { LectureId = lectureId, FilePath = pathToFile, Subject = subject, LectureText = LectureName, }); return Request.CreateResponse(HttpStatusCode.OK); } catch (Exception ex) { return Request.CreateResponse(HttpStatusCode.InternalServerError); } }
public async Task<IHttpActionResult> ActivateTutor([FromBody]TutorToActivate tutor) { var tutorManager = new TutorManager<TutorRequestStore, TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); tutorManager.ActivateTutor(tutor.TutorId); return Ok(); }
public async Task<IEnumerable<RequestInfo>> GetTutorRequests() { var tutorManager = new TutorManager<TutorRequestStore, TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); var result = await tutorManager.GetRequestInfo(); return result; }
public HttpResponseMessage GetById(string id) { var tutorManager = new TutorManager<TutorRequestStore, TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); Lecture result = tutorManager.GetLectureInfoById(id); if (result != null) return Request.CreateResponse<Lecture>(HttpStatusCode.OK,result); return Request.CreateResponse(HttpStatusCode.NotFound); }
public IEnumerable<string> GetDisciplines() { var tutorManager = new TutorManager<TutorRequestStore, TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); IEnumerable<string> result = tutorManager.GetAllDisciplines(); return result; }
public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var roleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(new ApplicationDbContext())); var user = new AppUser { UserName = model.Email, Email = model.Email }; if (model.AppRole == Role.Student) { string role = Role.Student.ToString(); //adding new client as student if (!roleManager.RoleExists(role)) { roleManager.Create(new IdentityRole(role)); } var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { UserManager.AddToRole(user.Id, role); await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return RedirectToAction("StudentIndex", "Home"); } AddErrors(result); } else if (model.AppRole == Role.Tutor) { string role = Role.Tutor.ToString(); if (!roleManager.RoleExists(role)) { roleManager.Create(new IdentityRole(role)); } var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { var tutorRequestManager = new TutorManager<TutorRequestStore,TutorRequest>(new TutorRequestStore(new ApplicationDbContext())); await tutorRequestManager.AddTutorRequest(new TutorRequest() { RequesterId = user.Id, RequestId = Guid.NewGuid().ToString() }); await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); return View("TutorInvitation"); } AddErrors(result); } } // If we got this far, something failed, redisplay form return View(model); }