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);
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
 public ArticlesController()
 {
     this.data = new UoWData();
     this.articlesService = new ArticlesService(this.data);
 }
Ejemplo n.º 4
0
 public BaseController(IUoWData data)
 {
     this.Data = data;
 }
Ejemplo n.º 5
0
 public ItemCategoriesController()
 {
     this.uoWData = new UoWData();
     this.itemsService = new ItemsService(this.uoWData);
 }
Ejemplo n.º 6
0
 public ItemsController()
 {
     this.data = new UoWData();
     this.itemsService = new ItemsService(this.data);
 }
Ejemplo n.º 7
0
 public ImagesService(IUoWData data)
 {
     this.Data = data;
 }
Ejemplo n.º 8
0
 public ArticlesController()
 {
     this.uoWData = new UoWData();
     this.ArticlesService = new ArticlesService(this.uoWData);
     this.imagesService = new ImagesService(this.uoWData);
 }
Ejemplo n.º 9
0
 public PagesController()
 {
     this.data = new UoWData();
     this.pagesService = new PagesService(data);
 }
Ejemplo n.º 10
0
 public GalleryController()
 {
     this.data = new UoWData();
     this.imagesService = new ImagesService(data);
 }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
 public ReservationsController()
 {
     this.data = new UoWData();
     this.reservationsService = new ReservationsService(data);
 }
Ejemplo n.º 13
0
 public AccountController(IUoWData db)
 {
     this.db = db;
 }
Ejemplo n.º 14
0
 public ArticlesService(IUoWData data)
 {
     this.Data = data;
 }
Ejemplo n.º 15
0
 public OrganizationController(IUoWData db)
 {
     this.db      = db;
     this.mongoDb = MongoClientFactory.GetDatabase();
 }
Ejemplo n.º 16
0
 public ItemFeaturesController()
 {
     this.uoWData = new UoWData();
     this.itemsService = new ItemsService(this.uoWData);
 }
 public UserController(IUoWData db)
 {
     this.db      = db;
     this.mongoDb = MongoClientFactory.GetDatabase();
 }
Ejemplo n.º 18
0
 public BaseController(IUoWData data)
 {
     this.Data = data;
 }
Ejemplo n.º 19
0
        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;
 }