public static async Task <User> User(this ControllerBase controller, Vc_webapiContext db) { if (controller.User.Identity.IsAuthenticated) { string userName = controller.User.Claims.SingleOrDefault(claim => claim.Type == "UserName")?.Value; if (!string.IsNullOrEmpty(userName)) { return(await db.Users.SingleOrDefaultAsync(user => user.UserName == userName)); } } return(null); }
private CoursesController ControllerFactory(Vc_webapiContext db, string userName) { var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim("UserName", userName), }, "mock")); return new CoursesController(db) { ControllerContext = new ControllerContext() { HttpContext = new DefaultHttpContext() { User = user } } }; }
public SearchController(Vc_webapiContext context) { db = context; }
public CoursesController(Vc_webapiContext context) { db = context; }
public CommentsController(Vc_webapiContext context, NotificationService notificationService) { this.notificationService = notificationService; db = context; }
public ScheduleController(Vc_webapiContext context) { db = context; }
public NotificationController(Vc_webapiContext context) { db = context; }
public UsersController(Vc_webapiContext context) { db = context; }
public VideosController(Vc_webapiContext context) { db = context; }
public NotificationService(Vc_webapiContext context) { db = context; }
public AuthenticationController(Vc_webapiContext modelDb, UserManager <IdentityUser> userManager, IJWTTokenGenerator tokenGenerator) { this.modelDb = modelDb; this.userManager = userManager; this.tokenGenerator = tokenGenerator; }
public VideostreamController(VideoStoreService videoStore, Vc_webapiContext db) { this.videoStore = videoStore; this.db = db; }
public EnrollmentsController(Vc_webapiContext context) { db = context; }