public async Task <IActionResult> Create([Bind("Id,IsEnabled,TopicNumber,Notes,ModuleId,Summary,Title,DateCreated,UserCreated,DateModified,UserModified,VideoUrl")] AdmTopic admTopic) { if (ModelState.IsValid) { //List<TopicFiles> fileDetails = new List<TopicFiles>(); //for (int i = 0; i < Request.Files.Count; i++) //{ // var file = Request.Files[i]; // if (file != null && file.ContentLength > 0) // { // var fileName = Path.GetFileName(file.FileName); // TopicFiles fileDetail = new TopicFiles() // { // FileName = fileName, // Extension = Path.GetExtension(fileName), // Id = Guid.NewGuid() // }; // fileDetails.Add(fileDetail); // var path = Path.Combine(Server.MapPath("~/App_Data/Upload/"), fileDetail.Id + fileDetail.Extension); // file.SaveAs(path); // } //} //admTopic.TopicFiles = fileDetails; _context.Add(admTopic); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ModuleId"] = new SelectList(_context.AdmModules, "ModuleId", "Title", admTopic.ModuleId); return(View(admTopic)); }
public async Task <IActionResult> Create([Bind("ResultId,StudentName,ExamName,Course,TotalQuestions,Attempted,NotAttempted,Correct,InCorrect,Score")] AdmResult admResult) { if (ModelState.IsValid) { _context.Add(admResult); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(admResult)); }
public async Task <IActionResult> Create([Bind("BlogId,Title,ShortDescription,Content,Meta,DateCreated,UserCreated,DateModified,UserModified")] Blog blog) { if (ModelState.IsValid) { _context.Add(blog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(blog)); }
public async Task <IActionResult> Create([Bind("InstructorId,FirstName,SurName,OtherNames,PreferedName,InstructorEmail,PhoneNumber,Country,DateCreated,UserCreated,DateModified,UserModified")] Instructor instructor) { if (ModelState.IsValid) { _context.Add(instructor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(instructor)); }
public async Task <IActionResult> Create([Bind("ExaminationId,Id,IsActive,Title,QuestionNo,Instructions")] ExamSetUp examSetUp) { if (ModelState.IsValid) { _context.Add(examSetUp); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Id"] = new SelectList(_context.AdmClass, "Id", "ClassName", examSetUp.Id); return(View(examSetUp)); }
public async Task <IActionResult> Create([Bind("Id,ClassName,CourseId,StartDate,EndDate,IsActive,DateCreated,UserCreated,DateModified,UserModified")] AdmClass admClass) { if (ModelState.IsValid) { _context.Add(admClass); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.AdmCourses, "CourseId", "CourseTitle", admClass.CourseId); return(View(admClass)); }
public async Task <IActionResult> Create([Bind("Id,InstructorId,CourseId,DateCreated,UserCreated,DateModified,UserModified")] InstructorCourse instructorCourse) { if (ModelState.IsValid) { _context.Add(instructorCourse); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.AdmCourses, "CourseId", "CourseTitle", instructorCourse.CourseId); ViewData["InstructorId"] = new SelectList(_context.Instructor, "InstructorId", "FullName", instructorCourse.InstructorId); return(View(instructorCourse)); }
public async Task <IActionResult> Create([Bind("QuestId,CourseId,ModuleId,Instructions,Question,Option1,Option2,Option3,Option4,RightAnswer")] Questions questions) { if (ModelState.IsValid) { _context.Add(questions); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.AdmCourses, "CourseId", "CourseTitle", questions.CourseId); ViewData["ModuleId"] = new SelectList(_context.AdmModules, "Title", "Title", questions.ModuleId); return(View(questions)); }
public async Task <IActionResult> Create([Bind("Id,IsApproved,IsCompleted,StudentId,CourseId,ApprovedDate,DateCreated,UserCreated,DateModified,UserModified")] StCourseEnrollment stCourseEnrollment) { if (ModelState.IsValid) { _context.Add(stCourseEnrollment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.AdmCourses, "CourseId", "CourseId", stCourseEnrollment.CourseId); ViewData["StudentId"] = new SelectList(_context.Student, "StudentId", "StudentFirstName", stCourseEnrollment.StudentId); return(View(stCourseEnrollment)); }
public async Task <IActionResult> Create([Bind("CourseId,CourseCode,IsEnabled,CourseTitle,VideoUrl,Description,DateCreated,UserCreated,DateModified,UserModified")] AdmCourses admCourses) { if (ModelState.IsValid) { _context.Add(admCourses); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } await Task.Delay(1500); return(View(admCourses)); }
public async Task <IActionResult> Create([Bind("ModuleId,Description,IsEnabled,CourseId,ModuleCode,Title,DateCreated,UserCreated,DateModified,UserModified")] AdmModules admModules) { if (ModelState.IsValid) { _context.Add(admModules); await _context.SaveChangesAsync(); await Task.Delay(1500); return(RedirectToAction(nameof(Index))); } ViewData["CourseId"] = new SelectList(_context.AdmCourses, "CourseId", "CourseTitle", admModules.CourseId); return(View(admModules)); }
public async Task <IActionResult> Create([Bind("AssignmentId,Description,IsEnabled,Title,Id,DateCreated,UserCreated,DateModified,UserModified")] AdmAssignment admAssignment) { if (User.Identity.IsAuthenticated) { if (ModelState.IsValid) { _context.Add(admAssignment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Id"] = new SelectList(_context.AdmClass, "Id", "ClassName", admAssignment.Id); return(View(admAssignment)); } return(RedirectToAction("Login", "Account")); }