Example #1
0
        protected ProfileViewModel SetAuthorDetails(UserGeneratedBaseViewModel vm)
        {
            if (vm == null)
            {
                return(null);
            }

            if (vm.Id == Guid.Empty || vm.UserId == Guid.Empty)
            {
                vm.UserId = CurrentUserId;
            }

            ProfileViewModel profile = ProfileAppService.GetUserProfileWithCache(vm.UserId);

            if (profile != null)
            {
                vm.AuthorName    = profile.Name;
                vm.AuthorPicture = UrlFormatter.ProfileImage(vm.UserId);
            }

            return(profile);
        }
Example #2
0
 protected static void SetBasePermissions(Guid currentUserId, UserGeneratedBaseViewModel vm)
 {
     vm.Permissions.CanEdit   = vm.UserId == currentUserId;
     vm.Permissions.CanDelete = vm.UserId == currentUserId;
 }
Example #3
0
 public static void SetShareUrl(this UserGeneratedBaseViewModel vm, string url)
 {
     vm.ShareUrl = url;
 }
Example #4
0
 public static void SetShareText(this UserGeneratedBaseViewModel vm, string text)
 {
     vm.ShareText = text;
 }