public UserUrls(ISimpleUser user) { GetProfileRoute = new RouteValueDictionary() { ["area"] = "Plato.Users", ["controller"] = "Home", ["action"] = "GetUser", ["opts.id"] = user.Id, ["opts.alias"] = user.Alias }; }
public UserAvatar(ISimpleUser user) { _user = user; if (_user.Id <= 0) { Url = "/images/photo.png"; } // If we have a photo Url use that if (!string.IsNullOrEmpty(_user.PhotoUrl)) { Url = _user.PhotoUrl; HasAvatar = true; } }
public UserCss(ISimpleUser user) { if (user.IsVerified) { VerifiedCss = "is-verified"; } if (user.IsStaff) { StaffCss = "is-staff"; } if (user.IsSpam) { SpamCss = "is-spam"; } if (user.IsBanned) { BannedCss = "is-banned"; } }
public UserAvatar(ISimpleUser user) { if (user.Id <= 0) { Url = "/images/photo.png"; return; } // If we have a photo Url use that if (!string.IsNullOrEmpty(user.PhotoUrl)) { Url = user.PhotoUrl; HasAvatar = true; return; } var letter = user.DisplayName != null ? user.DisplayName.ToLower().Substring(0, 1) : "-"; // Else fallback to our letter service Url = $"/u/l/{letter}/{user.PhotoColor}"; }
public bool Equals(ISimpleUser other) => Id == other.Id;
public virtual void PopulateModel(IDataReader dr) { if (dr.ColumnIsNotNull("Id")) { Id = Convert.ToInt32(dr["Id"]); } if (dr.ColumnIsNotNull("FeatureId")) { FeatureId = Convert.ToInt32(dr["FeatureId"]); } if (dr.ColumnIsNotNull("Name")) { Name = Convert.ToString(dr["Name"]); } if (dr.ColumnIsNotNull("Alias")) { Alias = Convert.ToString(dr["Alias"]); } if (dr.ColumnIsNotNull("Extension")) { Extension = Convert.ToString(dr["Extension"]); } if (dr.ColumnIsNotNull("ContentBlob")) { ContentBlob = (byte[])(dr["ContentBlob"]); } if (dr.ColumnIsNotNull("ContentType")) { ContentType = Convert.ToString(dr["ContentType"]); } if (dr.ColumnIsNotNull("ContentLength")) { this.ContentLength = Convert.ToInt64(dr["ContentLength"]); } if (dr.ColumnIsNotNull("ContentGuid")) { ContentGuid = Convert.ToString(dr["ContentGuid"]); } if (dr.ColumnIsNotNull("ContentCheckSum")) { ContentCheckSum = Convert.ToString(dr["ContentCheckSum"]); } if (dr.ColumnIsNotNull("TotalViews")) { TotalViews = Convert.ToInt32(dr["TotalViews"]); } if (dr.ColumnIsNotNull("ModuleId")) { ModuleId = Convert.ToString(dr["ModuleId"]); } if (dr.ColumnIsNotNull("CreatedUserId")) { CreatedUserId = Convert.ToInt32(dr["CreatedUserId"]); } if (CreatedUserId > 0) { CreatedBy = new SimpleUser { Id = CreatedUserId }; if (dr.ColumnIsNotNull("CreatedUserName")) { CreatedBy.UserName = Convert.ToString(dr["CreatedUserName"]); } if (dr.ColumnIsNotNull("CreatedDisplayName")) { CreatedBy.DisplayName = Convert.ToString(dr["CreatedDisplayName"]); } if (dr.ColumnIsNotNull("CreatedAlias")) { CreatedBy.Alias = Convert.ToString(dr["CreatedAlias"]); } if (dr.ColumnIsNotNull("CreatedPhotoUrl")) { CreatedBy.PhotoUrl = Convert.ToString(dr["CreatedPhotoUrl"]); } if (dr.ColumnIsNotNull("CreatedPhotoColor")) { CreatedBy.PhotoColor = Convert.ToString(dr["CreatedPhotoColor"]); } if (dr.ColumnIsNotNull("CreatedSignatureHtml")) { CreatedBy.SignatureHtml = Convert.ToString(dr["CreatedSignatureHtml"]); } if (dr.ColumnIsNotNull("CreatedIsVerified")) { CreatedBy.IsVerified = Convert.ToBoolean(dr["CreatedIsVerified"]); } if (dr.ColumnIsNotNull("CreatedIsStaff")) { CreatedBy.IsStaff = Convert.ToBoolean(dr["CreatedIsStaff"]); } if (dr.ColumnIsNotNull("CreatedIsSpam")) { CreatedBy.IsSpam = Convert.ToBoolean(dr["CreatedIsSpam"]); } if (dr.ColumnIsNotNull("CreatedIsBanned")) { CreatedBy.IsBanned = Convert.ToBoolean(dr["CreatedIsBanned"]); } } if (dr.ColumnIsNotNull("CreatedDate")) { CreatedDate = (DateTimeOffset)dr["CreatedDate"]; } if (dr.ColumnIsNotNull("ModifiedUserId")) { ModifiedUserId = Convert.ToInt32(dr["ModifiedUserId"]); } if (ModifiedUserId > 0) { ModifiedBy = new SimpleUser { Id = ModifiedUserId }; if (dr.ColumnIsNotNull("ModifiedUserName")) { ModifiedBy.UserName = Convert.ToString(dr["ModifiedUserName"]); } if (dr.ColumnIsNotNull("ModifiedDisplayName")) { ModifiedBy.DisplayName = Convert.ToString(dr["ModifiedDisplayName"]); } if (dr.ColumnIsNotNull("ModifiedAlias")) { ModifiedBy.Alias = Convert.ToString(dr["ModifiedAlias"]); } if (dr.ColumnIsNotNull("ModifiedPhotoUrl")) { ModifiedBy.PhotoUrl = Convert.ToString(dr["ModifiedPhotoUrl"]); } if (dr.ColumnIsNotNull("ModifiedPhotoColor")) { ModifiedBy.PhotoColor = Convert.ToString(dr["ModifiedPhotoColor"]); } if (dr.ColumnIsNotNull("ModifiedSignatureHtml")) { ModifiedBy.SignatureHtml = Convert.ToString(dr["ModifiedSignatureHtml"]); } if (dr.ColumnIsNotNull("ModifiedIsVerified")) { ModifiedBy.IsVerified = Convert.ToBoolean(dr["ModifiedIsVerified"]); } if (dr.ColumnIsNotNull("ModifiedIsStaff")) { ModifiedBy.IsStaff = Convert.ToBoolean(dr["ModifiedIsStaff"]); } if (dr.ColumnIsNotNull("ModifiedIsSpam")) { ModifiedBy.IsSpam = Convert.ToBoolean(dr["ModifiedIsSpam"]); } if (dr.ColumnIsNotNull("ModifiedIsBanned")) { ModifiedBy.IsBanned = Convert.ToBoolean(dr["ModifiedIsBanned"]); } } if (dr.ColumnIsNotNull("ModifiedDate")) { ModifiedDate = (DateTimeOffset)dr["ModifiedDate"]; } }
public UserUrls(ISimpleUser user) { this.ProfileUrl = $"u/{user.Id}/{user.Alias}"; this.GetProfileUrl = $"u/get/{user.Id}/{user.Alias}"; }