Esempio n. 1
0
        public static Basvuru basvuru(int KullaniciID)
        {
            CommunityContext db = new CommunityContext();
            Basvuru          b  = db.Basvuru.Where(x => x.kullanıcıID == KullaniciID).FirstOrDefault();

            return(b);
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //===============================================
            //==Repository config============================
            var config = new ServerConfig();

            Configuration.Bind(config);
            //_logger.LogInformation("config.MongoDB : " + config.MongoDB.ConnectionString);
            var cmnContext = new CommunityContext(config.MongoDB);
            var cmnRepo    = new CommunityRepository(cmnContext);

            services.AddSingleton <ICommunityRepository>(cmnRepo);

            //==Seed config==================================
            var cmnSeeder = new CommunitySeeder(cmnRepo);

            services.AddSingleton <ISeed>(cmnSeeder);

            //==MVC==========================================
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            //===Auto Mapper Configurations==================
            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new MappingProfile());
            });
            IMapper mapper = mappingConfig.CreateMapper();

            services.AddSingleton(mapper);
        }
Esempio n. 3
0
        public AppartmentControllerTest()
        {
            //_fixture = new Fixture();
            _mockLogger = new Mock <ILogger <AppartmentController> >();
            _mockRepo   = new Mock <ICommunityRepository>();
            var mappingConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new MappingProfile());
            });

            _mapper = mappingConfig.CreateMapper();


            if (new AppConfigration().IsRealMongoDbUsed())
            {
                var dbConfig  = new AppConfigration().GetMongoDBConfig();
                var dbContext = new CommunityContext(dbConfig);
                _repo = new CommunityRepository(dbContext);
                var dbSeeder = new CommunitySeeder(_repo);
                dbSeeder.Seed();

                _controller = new AppartmentController(_mockLogger.Object, _repo, _mapper);
            }
            else
            {
                _controller = new AppartmentController(_mockLogger.Object, _mockRepo.Object, _mapper);
            }
        }
Esempio n. 4
0
        public static List <string> getEmails(CommunityContext context)
        {
            List <string> users = context.Users //move to model
                                  .Select(u => u.Email)
                                  .ToList();

            return(users);
        }
 protected void CheckDbContext()
 {
     if (DbContext.IsDead)
     {
         var optionsBuilder = new DbContextOptionsBuilder <CommunityContext>();
         optionsBuilder.UseSqlServer(AppSettings.IdentityConnection);
         DbContext = new CommunityContext(optionsBuilder.Options);
     }
 }
Esempio n. 6
0
        public static Guncelle guncelle(int KullaniciID)
        {
            CommunityContext db = new CommunityContext();
            Kullanici        k  = db.Kullanici.Where(x => x.ID == KullaniciID).FirstOrDefault();

            Guncelle g = db.Guncelle.Where(x => x.kullanıcıID == KullaniciID).FirstOrDefault();

            return(g);
        }
Esempio n. 7
0
        public static async Task <bool> setDeletedMessagesAsync(string Id, CommunityContext context)
        {
            CommunityUser user = context.Users
                                 .Single(u => u.Id == Id);

            user.messagesDeleted = user.messagesDeleted + 1;
            context.Update(user);
            await context.SaveChangesAsync();

            return(true);
        }
Esempio n. 8
0
        public static async Task <bool> setLastLoggedInAsync(string Id, CommunityContext context)
        {
            CommunityUser user = context.Users
                                 .Single(u => u.Id == Id);

            user.lastLoggedIn = DateTime.Now;
            context.Update(user);
            await context.SaveChangesAsync();

            return(true);
        }
Esempio n. 9
0
        protected override void Seed(CommunityContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //
        }
Esempio n. 10
0
 public UserService(CommunityContext dbContext, IOptions <ApplicationSettings> appSettings) : base(dbContext, appSettings)
 {
 }
Esempio n. 11
0
 public CommunityTagRepository(CommunityContext context) : base(context)
 {
 }
Esempio n. 12
0
 public MessagesController(CommunityMessageContext context, UserManager <CommunityUser> userManager, CommunityContext context2)
 {
     _context     = context;
     _userManager = userManager;
     _context2    = context2; //maybe have user email here
 }
Esempio n. 13
0
 public MessageHandler(CommunityContext communityContext)
 {
     _communityContext = communityContext;
 }
Esempio n. 14
0
 public UserHandler(CommunityContext communityContext)
 {
     _communityContext = communityContext;
 }
Esempio n. 15
0
 public BaseService(CommunityContext dbContext, IOptions <ApplicationSettings> appSettings)
 {
     DbContext   = dbContext;
     AppSettings = appSettings?.Value;
 }
Esempio n. 16
0
 public GenericRepository(ICommunityContext context)
 {
     this.Context = ((CommunityContext)context);
     this.DbSet   = ((CommunityContext)context).Set <TEntity>();
 }
Esempio n. 17
0
        private static async Task <Account> GetTargetAccount(string apiPath, HttpSession session, CommunityContext community)
        {
            var     path = apiPath.Substring(1);
            var     id   = long.Parse(path);
            SteamID targetID;
            string  targetIDString = path;

            if (targetIDString != null)
            {
                targetID = new SteamID(long.Parse(targetIDString));
            }
            else
            {
                targetID = session.SteamID;
            }
            Account target = await community.Accounts.GetBySteamIDAsync(targetID);

            return(target);
        }
Esempio n. 18
0
 public static int getNrOfDeletedMessages(string Id, CommunityContext context)
 {
     return(context.Users
            .Single(u => u.Id == Id).messagesDeleted);
 }
Esempio n. 19
0
 public static string getEmail(string Id, CommunityContext context)
 {
     return(context.Users
            .Single(u => u.Id == Id).Email);
 }
Esempio n. 20
0
 public static DateTime getLastLoggedIn(string Id, CommunityContext context)
 {
     return(context.Users
            .Single(u => u.Id == Id).lastLoggedIn);
 }