public async Task <ActionResult> delete_attr() { var json = new StreamReader(Request.Body).ReadToEnd(); var attributes = JsonConvert.DeserializeObject <List <JGN_Attr_Attributes> >(json); foreach (var attr in attributes) { await AttrAttributeBLL.Delete(_context, attr.id); } return(Ok(new { status = "success", message = SiteConfig.generalLocalizer["_record_deleted"].Value })); }
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 })); }
public async Task <ActionResult> add_attr() { var json = new StreamReader(Request.Body).ReadToEnd(); var attr = JsonConvert.DeserializeObject <JGN_Attr_Attributes>(json); // attr.attr_type = (byte)AttrAttributeBLL.Attr_Type.Ad; if (attr.id > 0) { // update attribute await AttrAttributeBLL.Update(_context, attr); } else { attr = await AttrAttributeBLL.Add(_context, attr); } return(Ok(new { status = "success", record = attr, message = SiteConfig.generalLocalizer["_records_processed"].Value })); }
/// <summary> /// Add pre-defined section and few default attributes for user dynamic profile, for more control visit control panel -> users -> settings section. /// </summary> /// <param name="context"></param> public static async Task InitializeUserProfileDynamicAttributes(ApplicationDbContext context) { // Add default section to manage all user profile dynamic attributes if (await AttrTemplatesSectionsBLL.Count(context, new AttrTemplateSectionEntity() { attr_type = Attr_Type.UserProfile }) == 0) { var Sections = new List <JGN_Attr_TemplateSections> { new JGN_Attr_TemplateSections { title = "General", attr_type = (byte)Attr_Type.UserProfile, priority = 100, showsection = 0 }, }; foreach (var Section in Sections) { var output = await AttrTemplatesSectionsBLL.Add(context, Section); // Add few pre-defined user profile attributes. for more visit control panel -> users -> settings section var Attributes = new List <JGN_Attr_Attributes> { new JGN_Attr_Attributes { sectionid = output.id, title = "About Me", value = "", attr_type = (byte)Attr_Type.UserProfile, options = "", element_type = 5, // rich text editor isrequired = 0, variable_type = 0, icon = "0", helpblock = "Enter your brief bio.", min = 0, max = 0, priority = 100 }, new JGN_Attr_Attributes { sectionid = output.id, title = "Website", value = "", attr_type = (byte)Attr_Type.UserProfile, options = "", element_type = 0, // textbox isrequired = 0, variable_type = 0, icon = "0", helpblock = "Enter website", min = 0, max = 0, priority = 99 }, new JGN_Attr_Attributes { sectionid = output.id, title = "City", value = "City", attr_type = (byte)Attr_Type.UserProfile, options = "", element_type = 0, // textbox isrequired = 0, variable_type = 0, icon = "0", helpblock = "Enter city", min = 0, max = 0, priority = 98 } }; foreach (var Attribute in Attributes) { await AttrAttributeBLL.Add(context, Attribute); } } } }
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] })); } }