public bool AddNewInvoice(DB.CompanyInvoice invoice)
 {
     using (var context = new MyContext())
     {
         context.CompanyInvoices.Add(invoice);
         context.SaveChanges();
         return(true);
     }
 }
 public DB.CompanyInvoice EditInvoice(DB.CompanyInvoice invoice)
 {
     using (var context = new MyContext())
     {
         if (invoice != null)
         {
             context.Entry(invoice).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             return(invoice);
         }
         return(null);
     }
 }