public CommentCommandService( IRepository<Comment> commentRepository, IMathHubDbContext context) { this.ctx = context.GetDbContext();; this.commentRepository = commentRepository; }
public BlogCommandService( IRepository<Blog> blogRepository, IMathHubDbContext context) { this.ctx = context.GetDbContext(); this.blogRepository = blogRepository; }
public UserQueryService( IMathHubDbContext MathHubDbContext, IAuthenticationService authenticationService) { ctx = MathHubDbContext.GetDbContext(); this._authenticationService = authenticationService; }
public DiscussionCommandService( IRepository<Discussion> discussionRepository, IMathHubDbContext context) { this.ctx = context.GetDbContext(); this.discussionRepository = discussionRepository; }
public MainPostQueryService( IMathHubDbContext mathHubDbContext, IPostQueryService postQueryService) { this.ctx = mathHubDbContext.GetDbContext(); this._postQueryService = postQueryService; }
public ProblemQueryService( IMathHubDbContext mathHubDbContext, IUserQueryService userQueryService, IMainPostQueryService mainPostQueryService) { ctx = mathHubDbContext.GetDbContext(); this._userQueryService = userQueryService; this._mainPostQueryService = mainPostQueryService; }
public TagCommandService( IMathHubDbContext ctx, IRepository<Tag> tagRepository, ILogger logger) { this.ctx = ctx.GetDbContext(); this.tagRepository = tagRepository; this.logger = logger; }
public DiscussionQueryService( IRepository<Discussion> discussionRepository, IMathHubDbContext context, IMainPostQueryService mainPostQuerySerivce) { this.ctx = context.GetDbContext(); this._discussionRepository = discussionRepository; this._mainPostQuerySerivce = mainPostQuerySerivce; }
public FormAuthenticationService(IMathHubDbContext mathHubDbContext) { // temporary login with Thanh Hai User ctx = mathHubDbContext.GetDbContext(); if (WebSecurity.IsAuthenticated) { user = ctx.Users.FirstOrDefault(t => t.Username.Equals(WebSecurity.CurrentUserName)); } }
private static void TestReflectionAPI() { var func = ReflectionUtils.GetExpressionFindId<Problem>(2); var func1 = ReflectionUtils.GetExpressionFindId<Post>(2); MathHubModelContainer ctx = new MathHubModelContainer(); Post p = ctx.Posts.Where(func1).FirstOrDefault(); Problem problem = ctx.Posts.OfType<Problem>().Where(func).FirstOrDefault(); Console.WriteLine(p.Content); Console.WriteLine(problem.Title); Console.ReadLine(); }
public ProblemCommandService( IMathHubDbContext MathHubDbContext, IRepository<Problem> problemRepository, IMainPostCommandService mainPostCommandService, ILogger logger ) { this.ctx = MathHubDbContext.GetDbContext(); this.problemRepository = problemRepository; this.mainPostCommandService = mainPostCommandService; this.logger = logger; }
public MathHubDbContext() { ctx = new MathHubModelContainer(); // config option for DBContext ctx.Configuration.LazyLoadingEnabled = false; ctx.Configuration.ProxyCreationEnabled = false; // ctx.Configuration.LazyLoadingEnabled = true; // ctx.Configuration.ProxyCreationEnabled = true; // ctx.Configuration.AutoDetectChangesEnabled = true; Console.WriteLine("Create new DBContext"); }
public UserCommandService( IMathHubDbContext context, IRepository<User> userRepository, IRepository<Profile> profileRepository, IRepository<Image> imageRepository, IRepository<Activity> activityRepository, ILogger logger) { this.ctx = context.GetDbContext(); this.userRepository = userRepository; this.profileRepository = profileRepository; this.imageRepository = imageRepository; this.activityRepository = activityRepository; this.logger = logger; }
public MainPostCommandService( IMathHubDbContext MathHubDbContext, IRepository<Comment> commentRepository, IRepository<Reply> replyRepository, IRepository<PostTag> postTagRepository, IRepository<FavoritePost> favoritePostRepository, IRepository<Share> shareRepository, IAuthenticationService authenticationService, ILogger logger) { this.ctx = MathHubDbContext.GetDbContext(); this.replyRepository = replyRepository; this.commentRepository = commentRepository; this.postTagRepository = postTagRepository; this.authenticationService = authenticationService; this.favoritePostRepository = favoritePostRepository; this.shareRepository = shareRepository; this.logger = logger; }
public PermissionCommandService( IMathHubDbContext context) { this.ctx = context.GetDbContext(); }
public PostQueryService(IMathHubDbContext mathHubDbContext) { this.ctx = mathHubDbContext.GetDbContext(); }
public PermissionQueryService( IMathHubDbContext context) { this.ctx = context.GetDbContext(); }
public virtual ActionResult ExternalLoginConfirmation(RegisterExternalLoginModel model, string returnUrl) { string provider = null; string providerUserId = null; if (User.Identity.IsAuthenticated || !OAuthWebSecurity.TryDeserializeProviderUserId(model.ExternalLoginData, out provider, out providerUserId)) { return RedirectToAction("Manage"); } if (ModelState.IsValid) { // Insert a new user into the database using (MathHubModelContainer db = new MathHubModelContainer()) { User user = db.Users.FirstOrDefault(u => u.Username.ToLower() == model.UserName.ToLower()); // Check if user already exists if (user == null) { // Insert name into the profile table db.Users.Add(new User { Username = model.UserName }); db.SaveChanges(); OAuthWebSecurity.CreateOrUpdateAccount(provider, providerUserId, model.UserName); OAuthWebSecurity.Login(provider, providerUserId, createPersistentCookie: false); return RedirectToLocal(returnUrl); } else { ModelState.AddModelError("UserName", "User name already exists. Please enter a different user name."); } } } ViewBag.ProviderDisplayName = OAuthWebSecurity.GetOAuthClientData(provider).DisplayName; ViewBag.ReturnUrl = returnUrl; return View(model); }