Chaos.Portal.Core.Data.PortalRepository.SubscriptionCreate C# (CSharp) Method

SubscriptionCreate() public method

public SubscriptionCreate ( System.Guid guid, string name, System.Guid requestingUserGuid ) : SubscriptionInfo
guid System.Guid
name string
requestingUserGuid System.Guid
return SubscriptionInfo
        public SubscriptionInfo SubscriptionCreate(Guid? guid, string name, Guid requestingUserGuid)
        {
            guid = guid ?? Guid.NewGuid();

            var result = Gateway.ExecuteNonQuery("Subscription_Create", new[]
                {
                    new MySqlParameter("Guid", guid.Value.ToByteArray()),
                    new MySqlParameter("Name", name),
                    new MySqlParameter("RequestUserGuid", requestingUserGuid.ToByteArray())
                });

            if(result == -100) throw new InsufficientPermissionsException("User does not have sufficient permissions to access the subscription");
            if(result == -200) throw new UnhandledException("Unhanded exception in Subscription_Create and was rolled back");

            return SubscriptionGet(guid, requestingUserGuid).First();
        }