public CourseDetailPage(MCourse course) { InitializeComponent(); BindingContext = model = new CourseDetailVM(this.Navigation) { Course = course }; }
public async Task <IActionResult> Detail(CourseDetailVM detailVM) { Reply reply = new Reply { Name = detailVM.Reply.Name, Email = detailVM.Reply.Email, Subject = detailVM.Reply.Subject, Message = detailVM.Reply.Message }; _db.Replies.Add(reply); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Detail))); }
public async Task <IActionResult> Detail(int?id) { if (id == null) { return(NotFound()); } Course course = await _db.Courses.FindAsync(id); if (course == null) { return(NotFound()); } CourseDetailVM detailVM = new CourseDetailVM { Course = course, CourseDetails = _db.CourseDetails.Where(p => p.Id == course.CourseDetailId), CourseFeatures = _db.CourseFeatures.Where(p => p.Id == course.CourseFeatureId) }; return(View(detailVM)); }
public async Task <IActionResult> Detail(int?id) { if (id == null) { return(NotFound()); } Course course = await _db.Courses.FindAsync(id); if (course == null) { return(NotFound()); } CourseDetailVM detailVM = new CourseDetailVM { Background = _db.Backgrounds.FirstOrDefault(), Course = course, CourseDetails = _db.CourseDetails, Teachers = _db.Teachers.Take(3), Blogs = _db.Blogs.OrderByDescending(p => p.Id).Take(5), CourseFeatures = _db.CourseFeatures }; return(View(detailVM)); }