Exemplo n.º 1
0
        public void Create(OutStore ots)
        {
            using (var ctx = new LYLQEntities())
            {
                ctx.OutStores.Add(ots);

                ctx.SaveChanges();
            }
        }
Exemplo n.º 2
0
        public void Update(OutStore outStore)
        {
            using (var ctx = new LYLQEntities())
            {
                var dbOuts = from dbOut in ctx.OutStores
                              where dbOut.Id == outStore.Id
                              select dbOut;

                var dbModelOut = dbOuts.First();
                dbModelOut.InstoreId = outStore.InstoreId;
                dbModelOut.Code = outStore.Code;
                dbModelOut.UnitPrice = outStore.UnitPrice;
                dbModelOut.Number = outStore.Number;
                dbModelOut.TotalPrice = outStore.TotalPrice;
                dbModelOut.Department = outStore.Department;
                dbModelOut.Type = outStore.Type;
                dbModelOut.UpdatedBy = outStore.UpdatedBy;
                dbModelOut.UpdatedDate = DateTime.Now;

                ctx.SaveChanges();
            }
        }