示例#1
0
        public static int SaveInvoiceStatusLog(motskin_invoiceStatusLog element, bool withSave = true)
        {
            element.motskin_invoices        = GetInvoices().FirstOrDefault(p => p.id == element.invoiceID);
            element.motskin_invoiceStatuses = GetInvoiceStatuses().FirstOrDefault(p => p.id == element.invoiceStatusID);

            if (element.id == 0)
            {
                element.id = _invoiceStatusLog.Count + 1;
                _invoiceStatusLog.Add(element);
            }
            else
            {
                int pos = _invoiceStatusLog.IndexOf(_invoiceStatusLog.FirstOrDefault(p => p.id == element.id));
                if (pos >= 0)
                {
                    _invoiceStatusLog[pos] = element;
                }
            }
            return(_invoiceStatusLog.Count);
        }
示例#2
0
        public int SaveInvoiceStatusLog(motskin_invoiceStatusLog element, bool withSave = true)
        {
#if !PSEUDO
            if (element.id == 0)
            {
                db.motskin_invoiceStatusLog.Add(element);
                if (withSave)
                {
                    Save();
                }
            }
            else
            {
                db.Entry(element).State = EntityState.Modified;
                if (withSave)
                {
                    Save();
                }
            }
            return(element.id);
#else
            return(PseudoData.SaveInvoiceStatusLog(element));
#endif
        }