Exemplo n.º 1
0
        private Writeoff WriteoffEditModelToDb(WriteoffModelEdit Writeoff)
        {
            var WriteoffDb = Writeoff.Id != 0 ? _dataManager.Writeoffs.GetById(Writeoff.Id) : new Writeoff();

            WriteoffDb.Date          = Writeoff.Date;
            WriteoffDb.Comment       = Writeoff.Comment;
            WriteoffDb.ProductCounts = Writeoff.ProductCounts.Select(ProductCountModelToDb).ToList();

            return(WriteoffDb);
        }
Exemplo n.º 2
0
        public WriteoffModelEdit Save(WriteoffModelEdit Writeoff)
        {
            Writeoff WriteoffDb = WriteoffEditModelToDb(Writeoff);

            _dataManager.Writeoffs.Save(WriteoffDb);

            foreach (var productCount in WriteoffDb.ProductCounts)
            {
                _dataManager.ProductCounts.Save(productCount);
            }

            return(WriteoffEditDbToModel(WriteoffDb));
        }