Esempio n. 1
0
 public static WareDto FromDao(Ware dao)
 {
     return(new WareDto
     {
         WareId = dao.WareId,
         Price = dao.Price,
         WareName = dao.WareName,
     });
 }
Esempio n. 2
0
        protected override void Seed(CassaContext context)
        {
            for (int i = 1; i < 11; i++)
            {
                var ware = new Ware
                {
                    WareId   = i,
                    WareName = "test ware " + i,
                    Price    = i * 2,
                };
                context.Wares.Add(ware);

                context.WareRems.Add(new WareRem
                {
                    Ware = ware,
                    Qty  = 1000,
                });
            }
            context.SaveChanges();

            var check = new Check
            {
                Summ      = 100,
                CashboxId = 1,
                DateTM    = DateTime.Now,
            };



            check.Details = new List <CheckDetail>
            {
                new CheckDetail
                {
                    Check  = check,
                    WareId = 1,
                    Price  = 30,
                    Qty    = 2,
                },
                new CheckDetail
                {
                    Check  = check,
                    WareId = 2,
                    Price  = 15,
                    Qty    = 3,
                }
            };

            context.Checks.Add(check);
            context.SaveChanges();
        }