Example #1
0
        public bool Update(mo.Subscription Subscription)
        {
            var result = false;

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

            Subscription.ModificationTime = DateTime.UtcNow;

            _subscriptionRepo.Update(Subscription);

            result = true;


            return(result);
        }
Example #2
0
        public bool Add(mo.Subscription Subscription)
        {
            var result = false;
            try
            {
                if (Subscription == null)
                    throw new ArgumentNullException("Subscription");


                var name = Subscription.Name.Substring(0, 6);


                var query = from s in _subscriptionAuthRepo.Table
                            where s.Username.Substring(0,6) == name
                            orderby s.Id
                            select s;
                var existingName = query.ToList();

                //prepare object
                var SubscriptionAuth = new mo.SubscriptionAuth()
                {
                    SubscriptionId = Subscription.Id,
                     Pin =string.Empty,
                     Username = string.Empty
                };

                var currenSequence = existingName.Count() + 1;
                SubscriptionAuth.Username = name + (currenSequence > 9 ? currenSequence.ToString() : "0" + currenSequence.ToString());

                SubscriptionAuth.Pin = GeneratePin();
                _subscriptionAuthRepo.Insert(SubscriptionAuth);

                result = true;
            }
            catch(Exception ex)
            {

                throw;
            }

            return result;
        }
Example #3
0
        public bool Delete(mo.Subscription Subscription)
        {
            var result = false;

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

                _subscriptionRepo.Delete(Subscription);

                result = true;
            }
            catch
            {
                throw;
            }

            return(result);
        }
Example #4
0
        public bool Add(mo.Subscription Subscription)
        {
            var result = false;

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

                Subscription.CreationTime = DateTime.UtcNow;

                _subscriptionRepo.Insert(Subscription);

                result = true;
            }
            catch {
                throw;
            }

            return(result);
        }