コード例 #1
0
        public ActionResult ProfilePage(ContentModel content)
        {
            var membershipUser = Membership.GetUser();
            var user           = Services.MemberService.GetById((int)membershipUser.ProviderUserKey);
            var returnModel    = new ProfilePageModel(content.Content)
            {
                Person = new PersonModel()
                {
                    PrimeiroNome     = user.GetValue <string>("primeironome"),
                    DatadeNascimento = user.GetValue <string>("datadenascimento"),
                    Peso             = user.GetValue <int>("peso"),
                    Altura           = user.GetValue <int>("altura"),
                    CordoCabelo      = user.GetValue <string>("cordoCabelo"),
                    CordeOlhos       = user.GetValue <string>("cordeOlhos"),
                }
            };

            var avatarId = user.GetValue <int>("avatar");

            var avatar = UmbracoContext.MediaCache.GetById(avatarId);

            if (avatar != null)
            {
                returnModel.Person.ImagemUrl = avatar.Url;
            }
            else
            {
                return(CurrentTemplate(returnModel));
            }

            return(CurrentTemplate(returnModel));
        }
コード例 #2
0
        public ProfilePageModel GetOrganisation(int id)
        {
            List <OrganisationSurveyModel> surveys = new List <OrganisationSurveyModel>();
            var list = _sr.GetAllSurveysFromOrganisation(id);

            foreach (var item in list)
            {
                OrganisationSurveyModel survey = new OrganisationSurveyModel
                {
                    ID    = item.ID,
                    Title = item.Title
                };
                surveys.Add(survey);
            }

            var organisation             = _or.Get(id);
            ProfilePageModel profilePage = new ProfilePageModel
            {
                Name  = organisation.Name,
                Email = organisation.Email,
                Count = _sr.CountSurveyFromOrganisation(id),
                OrganisationSurvey = surveys
            };

            return(profilePage);
        }
コード例 #3
0
        public ActionResult ProfilePage(ContentModel content)
        {
            var membershipUser = Membership.GetUser();
            var user           = Services.MemberService.GetById((int)membershipUser.ProviderUserKey);
            var returnModel    = new ProfilePageModel(content.Content)
            {
                Profile = new Models.ProfileModel()
                {
                    NameandSurname = user.GetValue <string>("nameAndSurname"),
                    Birthday       = user.GetValue <string>("birthday"),
                    Weight         = user.GetValue <int>("weight"),
                    Height         = user.GetValue <int>("height"),
                    HairColor      = user.GetValue <string>("hairColor"),
                    EyeColor       = user.GetValue <string>("eyeColor"),
                }
            };

            var avatarId = user.GetValue <int>("avatar");

            var avatar = UmbracoContext.MediaCache.GetById(avatarId);

            if (avatar != null)
            {
                returnModel.Profile.ImagemUrl = avatar.Url;
            }
            else
            {
                return(CurrentTemplate(returnModel));
            }

            return(CurrentTemplate(returnModel));
        }
コード例 #4
0
        public static ProfilePageModel PopulateProfile()
        {
            ProfilePageModel profilePageModel = new ProfilePageModel();

            //profilePageModel.userInfo = ASPNetUser.GetUserByUserId();

            return(profilePageModel);
        }
コード例 #5
0
        // GET: Profile
        public ActionResult ProfilePage()
        {
            int userId       = (int)Session["CurrentUserId"];
            var groups       = userRepository.GetUsersGroupsById(userId);
            var invites      = inviteRepository.GetUserInvitesByUserId(userId);
            var inviteTuples = new List <Tuple <InviteItem, string, string> >();

            foreach (var invite in invites)
            {
                inviteTuples.Add(new Tuple <InviteItem, string, string>(invite, groupRepository.GetGroupNameById(invite.GroupId), userRepository.GetUsernameById(invite.Sender)));
            }
            ProfilePageModel model = new ProfilePageModel
            {
                Groups  = groups,
                Invites = inviteTuples
            };

            return(View(model));
        }
コード例 #6
0
        public ActionResult ProfilePage(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                id = User.Identity.GetUserId();
            }

            var employee = context.Employees.Find(id);
            var model    = new ProfilePageModel
            {
                Employee          = employee,
                RegisterViewModel = new RegisterViewModel {
                    UserId = id
                },
                Equipments = employee.Equipments
            };

            return(View(model));
        }
コード例 #7
0
        private async Task Profile()
        {
            try
            {
                var url = "https://api.twitter.com/1.1/users/show.json";
                _aPIservice = new APIservice();
                var data = new Dictionary <string, string>
                {
                    { "screen_name", "Birendr19286036" }
                };
                obj = await _aPIservice.GetResponse <ProfilePageModel>(url, data, "screen_name=Birendr19286036");

                Banner       = obj.profile_banner_url;
                ProfileImage = obj.profile_image_url;
                Name         = obj.name;
                Username     = obj.screen_name;
                Location     = obj.location;
                Description  = obj.description;
            }
            catch (Exception ex) { }
        }
コード例 #8
0
        private async Task Profile()
        {
            try
            {
                Authorization auth = new Authorization();
                var           url  = "https://api.twitter.com/1.1/users/show.json";

                using (var httpClient = new HttpClient())
                {
                    var data = new Dictionary <string, string>
                    {
                        { "screen_name", "ashishchopra01" }
                    };
                    httpClient.DefaultRequestHeaders.Add("Authorization", auth.PrepareOAuth(url, data, "GET"));
                    UriBuilder builder = new UriBuilder(url);
                    builder.Query = "screen_name=ashishchopra01";
                    var httpResponse = httpClient.GetAsync(builder.Uri).Result;
                    Console.WriteLine(httpResponse);
                    if (httpResponse.StatusCode.Equals(System.Net.HttpStatusCode.Unauthorized))
                    {
                        DisplayAlert("sorry", "You are not authorized", "ok");
                        return;
                    }
                    var httpContent = await httpResponse.Content.ReadAsStringAsync();

                    obj          = JsonConvert.DeserializeObject <ProfilePageModel>(httpContent);
                    Banner       = obj.profile_banner_url;
                    ProfileImage = obj.profile_image_url;
                    Name         = obj.name;
                    Username     = obj.screen_name;
                    Location     = obj.location;
                    Description  = obj.description;
                }
            }
            catch (Exception ex) { }
        }
コード例 #9
0
 public ProfilePageViewModel(ProfilePageModel currentPage) : base(currentPage)
 {
     _currentPage = currentPage;
 }