public IHttpActionResult GetUserFullInfo(string username)
        {
            var loggedUserId = this.User.Identity.GetUserId();
            var loggedUser   = this.TwitterData.Users.Find(loggedUserId);

            if (loggedUser == null)
            {
                return(this.BadRequest("Invalid session token."));
            }

//            var wallOwner = this.TwitterData.Users.All()
//                .Where(u => u.UserName == username)
//                .Select(ProfileDataViewModel.Create)
//                .FirstOrDefault();

            var targetUser = this.TwitterData.Users.All()
                             .FirstOrDefault(u => u.UserName == username);

            if (targetUser == null)
            {
                return(this.NotFound());
            }

            var targetUserInfo = ProfileDataViewModel.Create(targetUser, loggedUser);

            return(this.Ok(targetUserInfo));
        }
コード例 #2
0
        public FacebookClientSamplePage()
        {
            InitializeComponent();

            BindingContext = new ProfileDataViewModel();

            if (Device.RuntimePlatform == Device.iOS)
            {
                this.Padding = new Thickness(0, 20, 0, 0);
            }
        }
コード例 #3
0
        public async Task <ProfileDataViewModel> GetParticipantPanelAsync()
        {
            var us = await _db.Users.Where(u => u.UserName == HttpContext.Current.User.Identity.Name).SingleOrDefaultAsync();

            //var comlst = await _db.CommunityUsers.Include(x => x.Community).Where(u => u.UserID == us.Id).ToListAsync();
            var com        = await(from c in _db.CommunityUsers where c.UserID.Equals(us.Id) && c.Community.PrivacyID == 2 select c.Community).ToListAsync();
            var public_com = await _db.Communities.Where(u => u.PrivacyID == 1).ToListAsync();

            //var final_com = com.ToList().Union(public_com).ToList();
            var a = System.DateTime.Now;
            //var wf = await (from fc in _db.FormsCommunity join cu in _db.CommunityUsers on fc.CommunityID equals cu.CommunityID select new {frm = fc.QForms}).ToListAsync();

            //var fc = await _db.FormsCommunity

            //var pf = await (from c in _db.CommunityUsers where c.UserID.Equals(us.Id) select c.Community).T;

            var qf = await(from cu in _db.CommunityUsers join fc in _db.FormsCommunity on cu.CommunityID equals fc.CommunityID where (cu.UserID.Equals(us.Id)) select fc).ToListAsync();

            //IList<FormCommunity>pfs = await (from p in _db.FormsCommunity where p.Community.PrivacyID == 1 && p.QForms.Expiry_Time < a select p).ToListAsync();

            //IList<FormCommunity> pfa = await (from p in _db.FormsCommunity where p.Community.PrivacyID == 1 && p.QForms.Expiry_Time > a select p).ToListAsync();

            var activeform = await(from c in _db.CommunityUsers join p in _db.FormsCommunity on c.CommunityID equals p.CommunityID where c.UserID == us.Id && p.QForms.Expiry_Time > a select p).ToListAsync();

            var sealedform = await(from c in _db.CommunityUsers join p in _db.FormsCommunity on c.CommunityID equals p.CommunityID where c.UserID == us.Id && p.QForms.Expiry_Time < a select p).ToListAsync();
            var co         = public_com.Count + com.Count;

            int Tform = activeform.Count + sealedform.Count;

            ProfileDataViewModel pd = new ProfileDataViewModel();

            pd.UserT           = us;
            pd.CommunitiesList = com;
            pd.fc         = qf;
            pd.public_com = public_com;
            pd.com_count  = co;
            pd.Tform      = Tform;
            // pd.activeform = await (from c in _db.CommunityUsers join p in _db.FormsCommunity on c.CommunityID equals p.CommunityID where ((c.UserID == us.Id || p.Community.PrivacyID== 1) && p.QForms.Expiry_Time > a) select p.QForms).ToListAsync();

            // pd.sealedform = await (from c in _db.CommunityUsers join p in _db.FormsCommunity on c.CommunityID equals p.CommunityID where c.UserID == us.Id && p.QForms.Expiry_Time < a select p.QForms).ToListAsync();

            //pd.sealedform = pfs.ToList().Union(sealedform).ToList();

            //pd.activeform = pfa.ToList().Union(activeform).ToList();

            pd.activeform = activeform;

            pd.sealedform = sealedform;

            return(pd);
        }
        public IHttpActionResult GetProfileData()
        {
            var loggedUserId = this.User.Identity.GetUserId();
            var loggedUser   = this.TwitterData.Users.Find(loggedUserId);

            if (loggedUser == null)
            {
                return(this.BadRequest("Invalid session token."));
            }

            var profileDataView = ProfileDataViewModel.Create(loggedUser, loggedUser);

            return(this.Ok(profileDataView));
        }
コード例 #5
0
        public ProfileDataViewModel GetById(int Id)
        {
            ProfileTelephoneModel        model  = new ProfileTelephoneModel();
            List <ProfileTelephoneModel> myList = new List <ProfileTelephoneModel>();

            _dataProvider.ExecuteCmd(
                "ProfileData_GetById",
                inputParamMapper : delegate(SqlParameterCollection parmList)
            {
                parmList.AddWithValue("@Id", Id);
            },
                singleRecordMapper : delegate(IDataReader reader, short set)
            {
                int index = 0;
                model     = MapPDViewModel(reader, index);
                myList.Add(model);
            });

            ProfileDataViewModel profile = new ProfileDataViewModel();

            foreach (var ptm in myList)
            {
                profile.UserId         = ptm.UserId;
                profile.Email          = ptm.Email;
                profile.UserName       = ptm.UserName;
                profile.FirstName      = ptm.FirstName;
                profile.MiddleInitial  = ptm.MiddleInitial;
                profile.LastName       = ptm.LastName;
                profile.Gender         = ptm.Gender;
                profile.Bio            = ptm.Bio;
                profile.Title          = ptm.Title;
                profile.BasePath       = ptm.BasePath;
                profile.SystemFileName = ptm.SystemFileName;
                profile.BaseUrl        = BaseUrl;
                profile.ImageId        = ptm.ImageId;

                TelephoneDomainModel telephone = new TelephoneDomainModel();
                telephone.Id          = ptm.PhoneId;
                telephone.PhoneNumber = ptm.PhoneNumber;
                telephone.Extension   = ptm.PhoneExtension;
                telephone.PhoneType   = ptm.PhoneType;
                telephone.DisplayName = ptm.DisplayName;
                profile.Telephones.Add(telephone);
            }
            return(profile);
        }