public static SubscriptionDTO GetSubscriptionDetailsBySubscriptionId(int id)
 {
     using (Gymnastics_Studio_DataEntities GSDE = new Gymnastics_Studio_DataEntities())
     {
         Subscription Subscription = new Subscription();
         Subscription = GSDE.Subscriptions.FirstOrDefault(x => x.Id == id);
         return(SubscriptionDTO.ConvertToDTO(Subscription));
     }
 }
Ejemplo n.º 2
0
 public static SubscriptionDTO GetCurrentSubscription(int studentId)
 {
     using (Gymnastics_Studio_DataEntities GSDE = new Gymnastics_Studio_DataEntities())
     {
         StudentInSubscription CurrentstudentInSubscription = new StudentInSubscription();
         CurrentstudentInSubscription = GSDE.StudentInSubscriptions.Where(x => x.StudentId == studentId && x.StartDate <= DateTime.Now && x.FinishDate >= DateTime.Now).FirstOrDefault();
         Subscription currentSubscriptin = new Subscription();
         if (CurrentstudentInSubscription != default)
         {
             currentSubscriptin = GSDE.Subscriptions.Where(x => x.Id == CurrentstudentInSubscription.SubscribtionId).FirstOrDefault();
             return(SubscriptionDTO.ConvertToDTO(currentSubscriptin));
         }
         else
         {
             return(null);
         }
     }
 }