Esempio n. 1
0
 public ApiUser()
 {
     Id = 0;
     FirstName = "DummyFirst";
     LastName = "DummyLast";
     Email = "DummyMail";
     Subscriptions = new ApiSubscription[] { new ApiSubscription(), new ApiSubscription() };
 }
Esempio n. 2
0
 public ApiSubscription AddUserSubscription(int userId, ApiSubscription subscription)
 {
     using (rebtelEntities container = new rebtelEntities())
     {
         var user = container.Users.Find(userId);
         if (user == null)
         {
             throw new ArgumentNullException("No such user");
         }
         subscription.UrlFriendly = Utilities.toUrlFriendlyIndentifier(subscription.Name);
         user.Subscriptions.Add(subscription.ToEntity());
         container.SaveChanges();
         return subscription;
     }
 }
Esempio n. 3
0
 public ApiSubscription UpdateSubscription(ApiSubscription subValues)
 {
     using (serviceEntities container = new serviceEntities())
     {
         var sub = container.Subscriptions.Find(subValues.Id);
         if (sub == null)
         {
             throw new FaultException("No such subscription");
         }
         sub.Name = subValues.Name;
         sub.Price = subValues.Price;
         sub.PriceIncVatAmount = subValues.PriceIncVatAmount;
         sub.UrlFriendly = Utilities.toUrlFriendlyIndentifier(subValues.Name);
         container.SaveChanges();
         return new ApiSubscription(sub);
     }
 }