Exemplo n.º 1
0
 //Create
 public CPA Insert(CPA cpa)
 {
     using (OrderTrackEntities ctx = new OrderTrackEntities())
     {
         ctx.CPA.Add(cpa);
         ctx.SaveChanges();
         return(this);
     }
 }
Exemplo n.º 2
0
 //Create
 public CPA Insert(CPA cpa)
 {
     using (OrderTrackEntities ctx = new OrderTrackEntities())
     {
         ctx.CPA.Add(cpa);
         ctx.SaveChanges();
         return this;
     }
 }
Exemplo n.º 3
0
 //Update
 public CPA Update(CPA cpa)
 {
     using (OrderTrackEntities ctx = new OrderTrackEntities())
     {
         CPA CPA = ctx.CPA.First(x => x.CPAID == this.CPAID);
         CPA = cpa;
         ctx.SaveChanges();
         return(CPA);
     }
 }
Exemplo n.º 4
0
 //Update
 public CPA Update(CPA cpa)
 {
     using (OrderTrackEntities ctx = new OrderTrackEntities())
     {
         CPA CPA = ctx.CPA.First(x => x.CPAID == this.CPAID);
         CPA = cpa;
         ctx.SaveChanges();
         return CPA;
     }
 }
Exemplo n.º 5
0
 //Delete By ID
 public Boolean Delete(long id)
 {
     using (OrderTrackEntities ctx = new OrderTrackEntities())
     {
         try
         {
             CPA CPA = ctx.CPA.First(x => x.CPAID == id);
             ctx.CPA.Remove(CPA);
             ctx.SaveChanges();
             return(true);
         }
         catch (Exception ex)
         {
             return(false);
         }
     }
 }
 public CPA Put(CPA cpa)
 {
     return new CPA().Insert(cpa);
 }
 public CPA Post(CPA cpa)
 {
     return new CPA().Update(cpa);
 }