Esempio n. 1
0
 public ISubOption GetById(int id)
 {
     using (var context = new EPEntities())
     {
         sub_option subOption = context.sub_option.Find(id);
         context.Entry(subOption).Reference(s => s.option).Load();
         context.Entry(subOption).Reference(s => s.subscription).Load();
         return(subOption);
     }
 }
Esempio n. 2
0
 public ISubOption Create(int subscription_id, int option_id, DateTime start_date, DateTime end_date)
 {
     using (var context = new EPEntities())
     {
         sub_option c = new sub_option()
         {
             subscription_id = subscription_id,
             option_id       = option_id,
             start_date      = start_date,
             end_date        = end_date
         };
         context.sub_option.Add(c);
         context.SaveChanges();
         if (c.sub_option_id > 0)
         {
             return(c);
         }
         return(null);
     }
 }