public static Basvuru basvuru(int KullaniciID) { CommunityContext db = new CommunityContext(); Basvuru b = db.Basvuru.Where(x => x.kullanıcıID == KullaniciID).FirstOrDefault(); return(b); }
// 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); }
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); } }
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); } }
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); }
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); }
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); }
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" } // ); // }
public UserService(CommunityContext dbContext, IOptions <ApplicationSettings> appSettings) : base(dbContext, appSettings) { }
public CommunityTagRepository(CommunityContext context) : base(context) { }
public MessagesController(CommunityMessageContext context, UserManager <CommunityUser> userManager, CommunityContext context2) { _context = context; _userManager = userManager; _context2 = context2; //maybe have user email here }
public MessageHandler(CommunityContext communityContext) { _communityContext = communityContext; }
public UserHandler(CommunityContext communityContext) { _communityContext = communityContext; }
public BaseService(CommunityContext dbContext, IOptions <ApplicationSettings> appSettings) { DbContext = dbContext; AppSettings = appSettings?.Value; }
public GenericRepository(ICommunityContext context) { this.Context = ((CommunityContext)context); this.DbSet = ((CommunityContext)context).Set <TEntity>(); }
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); }
public static int getNrOfDeletedMessages(string Id, CommunityContext context) { return(context.Users .Single(u => u.Id == Id).messagesDeleted); }
public static string getEmail(string Id, CommunityContext context) { return(context.Users .Single(u => u.Id == Id).Email); }
public static DateTime getLastLoggedIn(string Id, CommunityContext context) { return(context.Users .Single(u => u.Id == Id).lastLoggedIn); }