public static void ToRow(Sequencer bean, SequencerRow row)
        {
            if (bean == null)
            {
                return;
            }

            row.Id    = bean.Id;
            row.Name  = bean.Name;
            row.Value = bean.Value;
        }
        internal static Sequencer ToBean(SequencerRow row)
        {
            if (row == null)
            {
                return(null);
            }

            var bean = new Sequencer();

            bean.Id    = row.Id;
            bean.Name  = row.Name;
            bean.Value = row.Value;
            return(bean);
        }
Beispiel #3
0
        /// <summary>
        /// Create data in database
        /// </summary>
        /// <param name="sequencer">Data</param>
        /// <returns>insert data</returns>
        public Sequencer Create(Sequencer sequencer)
        {
            if (sequencer == null)
            {
                return(null);
            }

            var sequencerRow = new SequencerRow();

            SequencerTransformer.ToRow(sequencer, sequencerRow);
            _dbContext.Sequencer.Add(sequencerRow);
            _dbContext.SaveChanges();
            return(SequencerTransformer.ToBean(sequencerRow));
        }