Ejemplo n.º 1
0
        public NewChannelData(
            Fifthweek.Api.Blogs.Shared.BlogId blogId,
            System.String name,
            System.Int32 price,
            System.Boolean isVisibleToNonSubscribers)
        {
            if (blogId == null)
            {
                throw new ArgumentNullException("blogId");
            }

            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (price == null)
            {
                throw new ArgumentNullException("price");
            }

            if (isVisibleToNonSubscribers == null)
            {
                throw new ArgumentNullException("isVisibleToNonSubscribers");
            }

            this.BlogId = blogId;
            this.Name   = name;
            this.Price  = price;
            this.IsVisibleToNonSubscribers = isVisibleToNonSubscribers;
        }
Ejemplo n.º 2
0
        public async Task <bool> IsOwnerAsync(UserId userId, Shared.BlogId blogId)
        {
            if (userId == null)
            {
                throw new ArgumentNullException("userId");
            }

            if (blogId == null)
            {
                throw new ArgumentNullException("blogId");
            }

            using (var connection = this.connectionFactory.CreateConnection())
            {
                return(await connection.ExecuteScalarAsync <bool>(
                           @"IF EXISTS(SELECT *
                                FROM   Blogs
                                WHERE  Id = @BlogId
                                AND    CreatorId = @CreatorId)
                        SELECT 1 AS FOUND
                    ELSE
                        SELECT 0 AS FOUND",
                           new
                {
                    BlogId = blogId.Value,
                    CreatorId = userId.Value
                }));
            }
        }
Ejemplo n.º 3
0
            public Parsed(
                Fifthweek.Api.Blogs.Shared.BlogId blogId,
                ValidChannelName name,
                ValidChannelPrice price,
                System.Boolean isVisibleToNonSubscribers)
            {
                if (blogId == null)
                {
                    throw new ArgumentNullException("blogId");
                }

                if (name == null)
                {
                    throw new ArgumentNullException("name");
                }

                if (price == null)
                {
                    throw new ArgumentNullException("price");
                }

                if (isVisibleToNonSubscribers == null)
                {
                    throw new ArgumentNullException("isVisibleToNonSubscribers");
                }

                this.BlogId = blogId;
                this.Name   = name;
                this.Price  = price;
                this.IsVisibleToNonSubscribers = isVisibleToNonSubscribers;
            }
Ejemplo n.º 4
0
        protected bool Equals(BlogId other)
        {
            if (!object.Equals(this.Value, other.Value))
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 5
0
        public CreateChannelCommand(
            Fifthweek.Api.Identity.Shared.Membership.Requester requester,
            Fifthweek.Api.Channels.Shared.ChannelId newChannelId,
            Fifthweek.Api.Blogs.Shared.BlogId blogId,
            Fifthweek.Api.Channels.Shared.ValidChannelName name,
            Fifthweek.Api.Channels.Shared.ValidChannelPrice price,
            System.Boolean isVisibleToNonSubscribers)
        {
            if (requester == null)
            {
                throw new ArgumentNullException("requester");
            }

            if (newChannelId == null)
            {
                throw new ArgumentNullException("newChannelId");
            }

            if (blogId == null)
            {
                throw new ArgumentNullException("blogId");
            }

            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (price == null)
            {
                throw new ArgumentNullException("price");
            }

            if (isVisibleToNonSubscribers == null)
            {
                throw new ArgumentNullException("isVisibleToNonSubscribers");
            }

            this.Requester    = requester;
            this.NewChannelId = newChannelId;
            this.BlogId       = blogId;
            this.Name         = name;
            this.Price        = price;
            this.IsVisibleToNonSubscribers = isVisibleToNonSubscribers;
        }