Exemplo n.º 1
0
        public void InsertStockmen(Stockmen stockmen)
        {
            if (stockmen == null)
            {
                throw new ValidationException("Stockmen not found", "");
            }

            Mapper.Initialize(cfg => cfg.CreateMap <Stockmen, AtlantDB.Models.Stockmen>());
            var stockmenDB = Mapper.Map <Stockmen, AtlantDB.Models.Stockmen>(stockmen);

            db.Stockmens.Create(stockmenDB);
            db.Save();
        }
Exemplo n.º 2
0
        public int GetDetailsAmount(Stockmen stockmen)
        {
            if (stockmen == null)
            {
                throw new ValidationException("Stockmen not found", "");
            }
            var detailCount = 0;

            foreach (var i in (from detail in db.Details.GetAll() where detail.Stockmen.StockmenId == stockmen.StockmenId select detail.Amount).ToList())
            {
                detailCount += (int)i;
            }
            return(detailCount);
        }