示例#1
0
 //Create
 public CPA Insert(CPA cpa)
 {
     using (OrderTrackEntities ctx = new OrderTrackEntities())
     {
         ctx.CPA.Add(cpa);
         ctx.SaveChanges();
         return(this);
     }
 }
示例#2
0
 //Create
 public CPA Insert(CPA cpa)
 {
     using (OrderTrackEntities ctx = new OrderTrackEntities())
     {
         ctx.CPA.Add(cpa);
         ctx.SaveChanges();
         return this;
     }
 }
示例#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);
     }
 }
示例#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;
     }
 }
示例#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);
 }