public MentorRepository( MentorContext context, UserManager <MODUser> userManager, RoleManager <IdentityRole> roleManager) { this.context = context; this.userManager = userManager; this.roleManager = roleManager; }
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)); }
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)); }
public MentorRepository(MentorContext context) { this.context = context; }
public async Task <ActionResult <Mentor> > DeleteMentor(int id) { MentorContext context = HttpContext.RequestServices.GetService(typeof(MentorContext)) as MentorContext; return(Ok(context.DeleteMentorById(id))); }
public async Task <ActionResult <bool> > PostMentor(Mentor mentor) { MentorContext context = HttpContext.RequestServices.GetService(typeof(MentorContext)) as MentorContext; return(Ok(context.AddMentor(mentor))); }
public MentorsController(MentorContext context) { _context = context; }