public async Task <IActionResult> Edit(Student model)
        {
            studentRepo = new StudentRepo();
            await studentRepo.Update(model);

            return(View());
        }
        public async Task <IActionResult> Create(Student model)
        {
            studentRepo = new StudentRepo();
            await studentRepo.Add(model);

            return(View());
        }
        public async Task <IActionResult> Delete(long id)
        {
            studentRepo = new StudentRepo();
            await studentRepo.Delete(id);

            return(View());
        }
 public BaseApplication(
     IEmailSender _emailSender,
     LocalDbContext _ldbc,
     EntityDbContext _edbc,
     ExamsDbContext _xdbc,
     IModuleRepo _moduleRepo,
     IAppDetails _app,
     IModuleMarkRepo _moduleMarkRepo,
     IModuleMarkChangeLogRepo _moduleMarkChangeLogRepo,
     ICMPMarksImportRepo _cmpMarksImportRepo,
     TestDbContext _tdbc,
     IStudentRepo _studentRepo
     )
 {
     emailSender             = _emailSender;
     ldbc                    = _ldbc;
     edbc                    = _edbc;
     tdbc                    = _tdbc;
     xdbc                    = _xdbc;
     moduleRepo              = _moduleRepo;
     moduleMarkRepo          = _moduleMarkRepo;
     moduleMarkChangeLogRepo = _moduleMarkChangeLogRepo;
     app = _app;
     cmpMarksImportRepo = _cmpMarksImportRepo;
     //Test cases
     studentRepo = _studentRepo;
 }
 public StudentController(IStudentRepo iStudentRepo,IAutogearRepo autogearRepo,IPostalRepo postalRepo,IInstructorRepo instructorRepo)
 {
     _iStudentRepo = iStudentRepo;
     _iAutogearRepo = autogearRepo;
     _iPostalRepo = postalRepo;
     _instructorRepo = instructorRepo;
 }
Example #6
0
 public StudentController(IStudentRepo repo, IHttpContextAccessor accessor)
 {
     studentRepo = repo;
     //get the userId out of the token and set the userid in the repo
     httpCtx = accessor;
     studentRepo.loggedInUserId = int.Parse(httpCtx.HttpContext.User.Claims.First(c => c.Type == "sub").Value);
 }
 public AutogearApiController(IInstructorRepo instructorRepo, IStudentRepo studentRepo, IPostalRepo postalRepo, ApplicationUserManager userManager)
 {
     _instructorRepo = instructorRepo;
     _studentRepo = studentRepo;
     _postalRepo = postalRepo;
     _userManager = userManager;
 }
Example #8
0
 public HomeController(IStudentRepo employeeRepo, IHostingEnvironment henv, IGuarantorRepo guarantorRepo, IPayment payment, IProgramCourses programCourses)
 {
     this._er            = employeeRepo;
     this.henv           = henv;
     this._guarantorRepo = guarantorRepo;
     this._payment       = payment;
     this._programcourse = programCourses;
 }
 public LessonController(ApplicationUserManager userManager, ApplicationRoleManager roleManager, IInstructorRepo instructorRepo, IPostalRepo postalRepo, IAutogearRepo autogearRepo, IStudentRepo studentRepo)
 {
     _userManager = userManager;
     _roleManager = roleManager;
     _instructorRepo = instructorRepo;
     _postalRepo = postalRepo;
     _autogearRepo = autogearRepo;
     _studentRepo = studentRepo;
 }
        public async Task <IActionResult> Index()
        {
            studentRepo = new StudentRepo();

            //get all data
            var getalldata = studentRepo.GetAll();

            //get single data
            var singledata = await studentRepo.Get(1);

            return(View());
        }
Example #11
0
        public void GetStudent_ShouldReturnBadRequest()
        {
            //Arrange
            testSchoolRegisterContext = new TestSchoolRegisterContext();
            studentRepo        = new MockStudentRepo(testSchoolRegisterContext);
            studentsController = new StudentsController(studentRepo);

            //Act
            IHttpActionResult actionResult = studentsController.GetStudent(null);

            //Assert
            Assert.IsInstanceOfType(actionResult, typeof(BadRequestResult));
        }
Example #12
0
        public void GetCoursesByStudentId_ShouldReturnNotFound()
        {
            // Arrange
            testSchoolRegisterContext = new TestSchoolRegisterContext();
            studentRepo        = new MockStudentRepo(testSchoolRegisterContext);
            studentsController = new StudentsController(studentRepo);

            //Act
            IHttpActionResult actionResult = studentsController.GetCoursesByStudentId("sampleStudentId");

            //Assert
            Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult));
        }
Example #13
0
        public void GetStudent_ShouldReturnForbidden()
        {
            //Arrange
            testSchoolRegisterContext = new TestSchoolRegisterContext();
            studentRepo        = new MockStudentRepo(testSchoolRegisterContext);
            studentsController = new StudentsController(studentRepo);
            PopulateStudentFields();

            //Act
            var actionResult = studentsController.GetStudent("unauthenticatedStudentId") as ResponseMessageResult;


            //Assert
            Assert.IsNotNull(actionResult);
            Assert.AreEqual(actionResult.Response.StatusCode, HttpStatusCode.Forbidden);
        }
Example #14
0
        public void GetStudent_ShouldReturnNotFound()
        {
            //Arrange
            testSchoolRegisterContext = new TestSchoolRegisterContext();
            studentRepo        = new MockStudentRepo(testSchoolRegisterContext);
            studentsController = new StudentsController(studentRepo);
            PopulateStudentFields();

            //Act
            var actionResult = studentsController.GetStudent("notExistingStudentId");


            //Assert
            Assert.IsNotNull(actionResult);
            Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult));
        }
Example #15
0
        public void PutStudent_ShouldReturnBadRequestDifferentId()
        {
            // Arrange
            testSchoolRegisterContext = new TestSchoolRegisterContext();
            studentRepo        = new MockStudentRepo(testSchoolRegisterContext);
            studentsController = new StudentsController(studentRepo);

            //Act
            IHttpActionResult actionResult =
                studentsController.PutStudent("notExistingStudentId", new Student {
                Id = "sampleStudentId"
            });

            //Assert
            Assert.IsInstanceOfType(actionResult, typeof(BadRequestResult));
        }
Example #16
0
        public void GetStudent_ShouldReturnOk()
        {
            //Arrange
            testSchoolRegisterContext = new TestSchoolRegisterContext();
            studentRepo        = new MockStudentRepo(testSchoolRegisterContext);
            studentsController = new StudentsController(studentRepo);
            PopulateStudentFields();

            //Act
            var actionResult  = studentsController.GetStudent("sampleStudentId");
            var contentResult = actionResult as OkNegotiatedContentResult <StudentBasicDto>;

            // Assert
            Assert.IsNotNull(contentResult);
            Assert.IsNotNull(contentResult.Content);
            Assert.AreEqual("sampleStudentId", contentResult.Content.Id);
        }
 public StudentService(IStudentRepo objStudentRepo)
 {
     _StudentRepo = objStudentRepo;
 }
 public StudentService(IStudentRepo repository)
 {
     _repository = repository;
 }
Example #19
0
 public UoW(SchoolContext schoolContext, IStudentRepo studentRepo, ICourseRepo courseRepo)
 {
     this.schoolContext = schoolContext;
     this.studentRepo   = studentRepo;
     this.courseRepo    = courseRepo;
 }
 public StudentService(IStudentRepo _studentRepo)
 {
     this.studentRepo = _studentRepo;
 }
Example #21
0
 public HomeController(IStudentRepo employeeRepo, IHostingEnvironment henv)
 {
     _er       = employeeRepo;
     this.henv = henv;
 }
Example #22
0
 public CommandsController(IStudentRepo repository)
 {
     _repository = repository;
 }
Example #23
0
 public PayController(IPaymentRepo repo, IStudentRepo studentrepo)
 {
     payRepo      = repo;
     student_repo = studentrepo;
 }
 public StudentsController(IStudentRepo repo)
 {
     _repo = repo;
 }
 //private readonly MockStudentRepo _repository = new MockStudentRepo();
 public StudentsController(IStudentRepo repository, IMapper mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }
 public StudentsController(IStudentRepo repo, IHostingEnvironment host)
 {
     _repo = repo;
     _host = host;
 }
Example #27
0
 public StudentController(IStudentRepo repository, IMapper mapper) //Dependency Injection
 {
     _repository = repository;
     _mapper     = mapper;
 }
 public UnitOfWork(IStudentRepo StudentRepo, ArchitectureEntities db)
 {
     _StudentRepo = StudentRepo;
     _db          = db;
 }
 public StudentsController(IStudentRepo repo, IMapper mapper)
 {
     this._repo = repo;
     _mapper    = mapper;
 }
Example #30
0
 public StudentsController(IStudentRepo db)
 {
     this._db = db;
 }
Example #31
0
 public StudentsController(NewAndNotificationContext context, IStudentRepo repository, IMapper mapper)
 {
     _context    = context;
     _repository = repository;
     _mapper     = mapper;
 }
Example #32
0
 public StudentService(IStudentRepo studentRepo)
 {
     _studentRepo = studentRepo;
 }
 public StudentsController(IStudentRepo <Students> studentRepo)
 {
     _studentRepo = studentRepo;
 }