public MentorRepository(
     MentorContext context,
     UserManager <MODUser> userManager,
     RoleManager <IdentityRole> roleManager)
 {
     this.context     = context;
     this.userManager = userManager;
     this.roleManager = roleManager;
 }
Exemplo n.º 2
0
        public async Task <ActionResult <Mentor> > GetMentor(int id)
        {
            MentorContext context       = HttpContext.RequestServices.GetService(typeof(MentorContext)) as MentorContext;
            Mentor        mentorDetails = context.GetMentorById(id);

            if (mentorDetails == null)
            {
                return(NoContent());
            }
            return(Ok(mentorDetails));
        }
Exemplo n.º 3
0
        public async Task <ActionResult <IEnumerable <Mentor> > > GetMentors()
        {
            MentorContext context        = HttpContext.RequestServices.GetService(typeof(MentorContext)) as MentorContext;
            List <Mentor> mentorsDetails = context.GetAllMentors();

            if (mentorsDetails == null || mentorsDetails.Count == 0)
            {
                return(NoContent());
            }
            return(Ok(mentorsDetails));
        }
Exemplo n.º 4
0
 public MentorRepository(MentorContext context)
 {
     this.context = context;
 }
Exemplo n.º 5
0
        public async Task <ActionResult <Mentor> > DeleteMentor(int id)
        {
            MentorContext context = HttpContext.RequestServices.GetService(typeof(MentorContext)) as MentorContext;

            return(Ok(context.DeleteMentorById(id)));
        }
Exemplo n.º 6
0
        public async Task <ActionResult <bool> > PostMentor(Mentor mentor)
        {
            MentorContext context = HttpContext.RequestServices.GetService(typeof(MentorContext)) as MentorContext;

            return(Ok(context.AddMentor(mentor)));
        }
Exemplo n.º 7
0
 public MentorsController(MentorContext context)
 {
     _context = context;
 }