Esempio n. 1
0
        public invoice InvoiceCreate(invoice _obj)
        {
            objDataContext = new DriveEntities();
            if (objDataContext.invoices.Count() > 0)
                _obj.InvoiceNumber = objDataContext.invoices.Max(x => x.InvoiceNumber) + 1;
            else
                _obj.InvoiceNumber = 1;
            objDataContext.AddToinvoices(_obj);
            objDataContext.SaveChanges();

            //_obj.InvoiceNumber = _obj.id;
            return _obj;
        }