コード例 #1
0
        public async Task <ActionResult> load_attr()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <AttrAttributeEntity>(json);

            data.nofilter = false;
            data.order    = "priority desc";
            var _posts = await AttrAttributeBLL.LoadItems(_context, data);

            var _records = 0;

            return(Ok(new { posts = _posts, records = _records }));
        }
コード例 #2
0
        public async Task <ActionResult> getinfo()
        {
            var json = new StreamReader(Request.Body).ReadToEnd();
            var data = JsonConvert.DeserializeObject <MemberEntity>(json);

            if (data.id == "")
            {
                var _post = new ApplicationUser();
                _post.options = await AttrTemplatesSectionsBLL.LoadItems(_context, new AttrTemplateSectionEntity()
                {
                    templateid = 0, // if you want to manage multiple templates for dynamic attributes use it here
                    attr_type  = Attr_Type.UserProfile,
                    order      = "priority desc",
                    iscache    = true
                });

                foreach (var option in _post.options)
                {
                    option.attributes = await AttrAttributeBLL.LoadItems(_context, new AttrAttributeEntity()
                    {
                        sectionid = option.id,
                        order     = "priority desc",
                        iscache   = true,
                        attr_type = (byte)Attr_Type.UserProfile
                    });
                }
                return(Ok(new { status = "success", post = _post }));
            }
            else
            {
                var _posts = await UserProfileBLL.LoadItems(_context, data);

                if (_posts.Count == 0)
                {
                    return(Ok(new { status = "error", message = SiteConfig.generalLocalizer["_no_records"].Value }));
                }

                // Raw Attributes
                _posts[0].options = await AttrTemplatesSectionsBLL.LoadItems(_context, new AttrTemplateSectionEntity()
                {
                    templateid = 0, // if you want to manage multiple templates for dynamic attributes use it here
                    order      = "priority desc",
                    attr_type  = Attr_Type.UserProfile,
                    iscache    = true
                });

                foreach (var option in _posts[0].options)
                {
                    option.attributes = await AttrAttributeBLL.LoadItems(_context, new AttrAttributeEntity()
                    {
                        sectionid = option.id,
                        order     = "priority desc",
                        iscache   = true,
                        attr_type = (byte)Attr_Type.UserProfile
                    });
                }

                _posts[0].attr_values = await AttrValueBLL.LoadItems(_context, new AttrValueEntity()
                {
                    userid    = _posts[0].Id,
                    attr_type = Attr_Type.UserProfile,
                    nofilter  = false
                });

                _posts[0].img_url = UserUrlConfig.ProfilePhoto(_posts[0].UserName, _posts[0].picturename, 0); // default set
                _posts[0].url     = UserUrlConfig.ProfileUrl(_posts[0], Configs.RegistrationSettings.uniqueFieldOption);
                _posts[0].customize_register_date = UtilityBLL.CustomizeDate((DateTime)_posts[0].created_at, DateTime.Now);
                if (_posts[0].last_login != null)
                {
                    _posts[0].customize_last_login = UtilityBLL.CustomizeDate((DateTime)_posts[0].last_login, DateTime.Now);
                }
                return(Ok(new { status = "ok", post = _posts[0] }));
            }
        }