Exemple #1
0
        public static int SaveMailStatusLog(motskin_mailStatusLog element, bool withSave = true)
        {
            element.motskin_mails        = GetMails().FirstOrDefault(p => p.id == element.mailID);
            element.motskin_mailStatuses = GetMailStatuses().FirstOrDefault(p => p.id == element.mailStatusID);

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