protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CoursesService courseService = new CoursesService(); RepeaterCourse.DataSource = courseService.GetAll(); RepeaterCourse.DataBind(); } }
public void GEtAllMappedNoCourses() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var repository = new EfDeletableEntityRepository <Course>(new ApplicationDbContext(options.Options)); var userRepository = new EfDeletableEntityRepository <ApplicationUser>(new ApplicationDbContext(options.Options)); var coursesService = new CoursesService(repository, userRepository); AutoMapperConfig.RegisterMappings(typeof(CategoryServicesTests.MyTestPost).Assembly); var post = coursesService.GetAll <MyTest>(); Assert.Equal(0, repository.All().Count()); }
// GET: Courses public ActionResult Index() { return(View(coursesService.GetAll())); }
public ActionResult Get() { string userId = this.User.Claims.FirstOrDefault(i => i.Type == "userid").Value; return(new JsonResult(coursesService.GetAll(userId))); }
public void GetAllCourses() { var courses = (List <Course>)CoursesService.GetAll(); Assert.IsTrue(courses.Count > 5); }
public async Task <ActionResult <IEnumerable <Course> > > GetCourses() { return(await CoursesService.GetAll().AsNoTracking().ToListAsync()); }