Exemple #1
0
        public IHttpActionResult GetPageManagers(int artistPageId)
        {
            //first lets find out if current user can actually play around with this page
            var artistPage = _artistPageService.Get(artistPageId);
            var model      = new List <object>();

            if (CanDelete(artistPage))
            {
                //so the current user is actually admin or the page owner. let's find managers

                var managers = _artistPageManagerService.GetPageManagers(artistPageId);

                foreach (var manager in managers)
                {
                    var customer = _userService.Get(manager.CustomerId);

                    if (customer == null)
                    {
                        continue;
                    }

                    var customerThumbnailUrl = _pictureService.GetPictureUrl(customer.GetPropertyValueAs <int>(PropertyNames.DefaultPictureId));

                    model.Add(new {
                        CustomerDisplayName = customer.FirstName + " " + customer.LastName,
                        SeName          = customer.GetPermalink()?.Slug,
                        ProfileImageUrl = customerThumbnailUrl,
                        Id = customer.Id
                    });
                }

                return(Response(model));
            }
            return(Response(model));
        }
        public IHttpActionResult GetPageManagers(int artistPageId)
        {
            //first lets find out if current user can actually play around with this page
            var artistPage = _artistPageService.Get(artistPageId);
            var model      = new List <object>();

            if (CanDelete(artistPage))
            {
                //so the current user is actually admin or the page owner. let's find managers

                var managers = _artistPageManagerService.GetPageManagers(artistPageId);

                foreach (var manager in managers)
                {
                    var customer = _userService.Get(manager.CustomerId);

                    if (customer == null)
                    {
                        continue;
                    }

                    var customerThumbnailUrl = _pictureService.GetPictureUrl(
                        customer.GetAttribute <int>(SystemCustomerAttributeNames.AvatarPictureId),
                        100,
                        true);

                    model.Add(new {
                        CustomerDisplayName = customer.GetFullName().ToTitleCase(),
                        ProfileUrl          = Url.Route("CustomerProfileUrl", new RouteValueDictionary()
                        {
                            { "SeName", customer.GetSeName(0) }
                        }),
                        ProfileImageUrl = customerThumbnailUrl,
                        Id = customer.Id
                    });
                }

                return(Response(model));
            }
            return(Response(model));
        }