public List <DisplayProfileViewModel> GetUsersByOrganization(int?organizationID)
        {
            UserProfileRepository repo = new UserProfileRepository();
            var yourProfiles           = repo.Get().Where(s => s.OrganizationID == organizationID).ToList();

            return(users(yourProfiles));
        }
Esempio n. 2
0
        public ProfileViewModel GetProfileByUserProfileID(int userProfileID)
        {
            UserProfileRepository repo        = new UserProfileRepository();
            ICountryRepository    countryRepo = new CountryRepository();
            IStateRepository      stateRepo   = new StateRepository();
            ICityRepository       cityRepo    = new CityRepository();

            ProfileViewModel viewModel = new ProfileViewModel();

            var yourProfile = repo.Get().Where(s => s.UserProfileID == userProfileID).FirstOrDefault();

            if (yourProfile != null)
            {
                var city    = cityRepo.Get().Where(s => s.CityID == yourProfile.CityID).FirstOrDefault();
                var state   = stateRepo.Get().Where(s => s.StateID == city.StateID).FirstOrDefault();
                var country = countryRepo.Get().Where(s => s.CountryID == state.CountryID).FirstOrDefault();

                viewModel.UserID         = yourProfile.UserID;
                viewModel.UserProfileID  = yourProfile.UserProfileID;
                viewModel.OrganizationID = yourProfile.OrganizationID;
                viewModel.FirstName      = yourProfile.FirstName;
                viewModel.LastName       = yourProfile.LastName;
                viewModel.Address        = yourProfile.Address;
                viewModel.Gender         = yourProfile.Gender;
                viewModel.MobileNO       = yourProfile.PhoneNo;
                viewModel.ProfilePicPath = yourProfile.ProfilePicPath;
                viewModel.DOB            = yourProfile.DOB;
                viewModel.City           = city.CityName;
                viewModel.State          = state.StateName;
                viewModel.Country        = country.CoutnryName;
            }
            return(viewModel);
        }
        public List <DisplayProfileViewModel> GetUsers()
        {
            UserProfileRepository repo = new UserProfileRepository();
            var yourProfiles           = repo.Get();

            return(users(yourProfiles));
        }
Esempio n. 4
0
        public bool?IsProfilecompleted(string userID)
        {
            IUserProfileRepository profileRepo = new UserProfileRepository();
            var profile = profileRepo.Get().Where(s => s.UserID == userID);

            return(profile.Select(s => s.ProfileCompeted).FirstOrDefault());
        }
Esempio n. 5
0
        public EditUserProfileViewModel EditUserProfile(string userID, int?orgID)
        {
            IUserProfileRepository profileRepo = new UserProfileRepository();
            ICountryRepository     countryRepo = new CountryRepository();
            IStateRepository       stateRepo   = new StateRepository();
            ICityRepository        cityRepo    = new CityRepository();

            var yourProfile = profileRepo.Get().Where(s => s.UserID == userID && s.OrganizationID == orgID).FirstOrDefault();
            //var city = cityRepo.Get().Where(s => s.CityID == yourProfile.CityID).FirstOrDefault();
            //var state = stateRepo.Get().Where(s => s.StateID == city.StateID).FirstOrDefault();
            //var country = countryRepo.Get().Where(s => s.CountryID == state.CountryID).FirstOrDefault();

            EditUserProfileViewModel viewModel = new EditUserProfileViewModel();

            viewModel.UserID         = userID;
            viewModel.OrganizationID = orgID;
            viewModel.FirstName      = yourProfile.FirstName;
            viewModel.LastName       = yourProfile.LastName;
            viewModel.Address        = yourProfile.Address;
            viewModel.Gender         = yourProfile.Gender;
            viewModel.MobileNO       = yourProfile.PhoneNo;
            viewModel.ProfilePicPath = yourProfile.ProfilePicPath;
            viewModel.DOB            = yourProfile.DOB;
            //viewModel.City = city.CityName;
            //viewModel.State = state.StateName;
            //viewModel.Country = country.CoutnryName;
            return(viewModel);
        }
        public void Get_IncludeProperties_ReturnItem(int id)
        {
            var repository = new UserProfileRepository(_dbContext, _cache.Object, _logger.Object);
            var item       = repository.Get(id, u => u.AppUser);

            Assert.NotNull(item);
            Assert.NotNull(item.AppUser);
        }
        public void Get_ReturnItem(int id)
        {
            var repository = new UserProfileRepository(_dbContext, _cache.Object, _logger.Object);
            var item       = repository.Get(id);

            Assert.NotNull(item);
            Assert.Equal(id, item.Id);
        }
Esempio n. 8
0
        public void UserRepository_AddItem_IsNotNullWhenGet()
        {
            var dbData = new DalUserProfile
            {
                Id = 100,
                Email = "mail1",
                Name = "name1",
                Password = "******"
            };
            var dbSetMock = new Mock<DbSet<OrmUserProfile>>();
            var dbContextMock = new Mock<EntityModelContext>();
            dbContextMock.Setup(x => x.Set<OrmUserProfile>()).Returns(dbSetMock.Object);

            var repo = new UserProfileRepository(dbContextMock.Object);
            repo.Add(dbData);
            Assert.IsNotNull(repo.Get(100));
        }
Esempio n. 9
0
        public void UserRepository_AddItem_IsNotNullWhenGet()
        {
            var dbData = new DalUserProfile
            {
                Id       = 100,
                Email    = "mail1",
                Name     = "name1",
                Password = "******"
            };
            var dbSetMock     = new Mock <DbSet <OrmUserProfile> >();
            var dbContextMock = new Mock <EntityModelContext>();

            dbContextMock.Setup(x => x.Set <OrmUserProfile>()).Returns(dbSetMock.Object);

            var repo = new UserProfileRepository(dbContextMock.Object);

            repo.Add(dbData);
            Assert.IsNotNull(repo.Get(100));
        }
Esempio n. 10
0
        public List <OrganizationUsersViewModel> DashboardStats()
        {
            IUserProfileRepository  userProfileRepository  = new UserProfileRepository();
            IOrganizationRepository organizationRepository = new OrganizationRepository();

            List <OrganizationUsersViewModel> viewModelList = new List <OrganizationUsersViewModel>();

            var organizations = organizationRepository.Retrive();

            foreach (var item in organizations)
            {
                OrganizationUsersViewModel viewModel = new OrganizationUsersViewModel();
                viewModel.OrganizationID   = item.OrganizationID;
                viewModel.OrganizationName = item.Name;
                viewModel.UsersCount       = userProfileRepository.Get().Where(s => s.OrganizationID == item.OrganizationID).Count();

                viewModelList.Add(viewModel);
            }
            return(viewModelList);
        }
Esempio n. 11
0
        public ActionResult Index()
        {
            var userProfile = _userProfileRepository.Get(User.Identity.GetUserId());

            return(View(userProfile));
        }