public void AddAcctRec(AcctRec acctrec)
 {
     using (var db = new Entities())
     {
         db.AcctRecs.Add(acctrec);
         db.SaveChanges();
     }
 }
        public void UpdateAcctRec(AcctRec acctrecUpdate)
        {
            try
            {
                using (var db = new Entities())
                {
                    AcctRec original = new AcctRec {
                        Id = acctrecUpdate.Id
                    };                                                          /// stub model, only has Id

                    var entry = db.Entry(original);
                    entry.State = System.Data.Entity.EntityState.Modified;
                    entry.CurrentValues.SetValues(acctrecUpdate);

                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #3
0
 public AccountReceiveableView(AcctRec acctRec)
 {
     this.AcctRecId            = acctRec.AcctRecId;
     this.OpenAmount           = acctRec.OpenAmount;
     this.DiscountDueDate      = acctRec.DiscountDueDate;
     this.PaymentDueDate       = acctRec.PaymentDueDate;
     this.GLDate               = acctRec.GLDate;
     this.InvoiceId            = acctRec.InvoiceId;
     this.InvoiceNumber        = acctRec.Invoice.InvoiceNumber;
     this.CreateDate           = acctRec.CreateDate;
     this.DocNumber            = acctRec.DocNumber;
     this.Remarks              = acctRec.Remarks;
     this.PaymentTerms         = acctRec.PaymentTerms;
     this.CustomerId           = acctRec.CustomerId;
     this.CustomerName         = acctRec.Customer.AddressBook.Name;
     this.PurchaseOrderId      = acctRec.PurchaseOrderId ?? 0;
     this.Description          = acctRec.Description;
     this.AcctRecDocTypeXRefId = acctRec.AcctRecDocTypeXRefId;
     this.DocType              = acctRec.UDC.Value;
     this.Amount               = acctRec.Amount;
     this.AccountId            = acctRec.AccountId;
 }
 // PUT api/<controller>/5
 public void Put(int id, [FromBody] AcctRec acctrec)
 {
     _acctRecRepository.UpdateAcctRec(acctrec);
 }
 // POST api/<controller>
 public void Post([FromBody] AcctRec acctrec)
 {
     _acctRecRepository.AddAcctRec(acctrec);
 }