Beispiel #1
0
        public void Create(Materiel mat)
        {
            using (var ctx = new LYLQEntities())
            {
                ctx.Materiels.Add(mat);

                ctx.SaveChanges();
            }
        }
Beispiel #2
0
        public void Update(Materiel mat)
        {
            using (var ctx = new LYLQEntities())
            {
                var dbMats = from dbMat in ctx.Materiels
                             where dbMat.Code == mat.Code
                             select dbMat;

                var dbModelDpt = dbMats.First();
                dbModelDpt.Name = mat.Name;
                dbModelDpt.UpdatedBy = mat.UpdatedBy;
                dbModelDpt.UpdatedDate = DateTime.Now;

                ctx.SaveChanges();
            }
        }