public static bool AuthKeyIsValid(IUoWData db, string authKey) { var found = db.Users.All().FirstOrDefault(x => x.AuthKey == authKey); if (found == null) { return(false); } else { return(true); } }
public BaseController() { this.data = new UoWData(); this.itemsService = new ItemsService(this.data); this.articlesService = new ArticlesService(this.data); this.pagesService = new PagesService(this.data); LayoutModel model = new LayoutModel(); model.ItemCategories = this.itemsService.GetItemCategories(); model.Articles = this.articlesService.GetArticles().Take(5); model.Pages = this.pagesService.GetPages(); ViewBag.LayoutModel = model; }
public ArticlesController() { this.data = new UoWData(); this.articlesService = new ArticlesService(this.data); }
public BaseController(IUoWData data) { this.Data = data; }
public ItemCategoriesController() { this.uoWData = new UoWData(); this.itemsService = new ItemsService(this.uoWData); }
public ItemsController() { this.data = new UoWData(); this.itemsService = new ItemsService(this.data); }
public ImagesService(IUoWData data) { this.Data = data; }
public ArticlesController() { this.uoWData = new UoWData(); this.ArticlesService = new ArticlesService(this.uoWData); this.imagesService = new ImagesService(this.uoWData); }
public PagesController() { this.data = new UoWData(); this.pagesService = new PagesService(data); }
public GalleryController() { this.data = new UoWData(); this.imagesService = new ImagesService(data); }
internal static void CreateUserOrganizationRelation(Organization organization, string authKey, UserRoles role, IUoWData db, MongoDatabase mongoDb) { var sqlUser = db.Users.All().Single(x => x.AuthKey == authKey); var usersCollection = mongoDb.GetCollection(MongoCollections.Users); var mongoUser = usersCollection.FindOneAs <User>(Query.EQ("_id", new ObjectId(sqlUser.MongoId))); var usersOrganizations = mongoDb.GetCollection(MongoCollections.UsersInOrganizations); UsersOrganizations newRelation = new UsersOrganizations() { UserId = mongoUser._MongoId, OrganizationId = organization.Id, OrganizationName = organization.Name, Username = mongoUser.Username, Role = role }; usersOrganizations.Save(newRelation); }
public ReservationsController() { this.data = new UoWData(); this.reservationsService = new ReservationsService(data); }
public AccountController(IUoWData db) { this.db = db; }
public ArticlesService(IUoWData data) { this.Data = data; }
public OrganizationController(IUoWData db) { this.db = db; this.mongoDb = MongoClientFactory.GetDatabase(); }
public ItemFeaturesController() { this.uoWData = new UoWData(); this.itemsService = new ItemsService(this.uoWData); }
public UserController(IUoWData db) { this.db = db; this.mongoDb = MongoClientFactory.GetDatabase(); }
internal static void CheckUser(string authKey, Organization queriedOrganization, MongoCollection <UsersOrganizations> usersAndOrganizations, out UsersOrganizations foundUser, UserRoles role, IUoWData db) { var userMongoId = db.Users.All().Single(x => x.AuthKey == authKey).MongoId; foundUser = usersAndOrganizations.AsQueryable <UsersOrganizations>() .FirstOrDefault(x => x.Role >= role && x.UserId == new ObjectId(userMongoId) && x.OrganizationName == queriedOrganization.Name); }
public ValuesController(IUoWData db) { this.db = db; }