예제 #1
0
        public bool UpdServicii(int id_l, int id_s, DateTime data, bool check, int code)
        {
            if (code == 0)
                return false;

            using (var context = new ServiciiATMContext())
            {
                using (var transaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        var serv = new Servicii
                        {
                            ID_ls = id_l,
                            ID_S = id_s,

                        };
                        context.Serviciis.Add(serv);
                        context.Entry(serv).State = System.Data.Entity.EntityState.Modified;
                        context.SaveChanges();
                        transaction.Commit();
                        return true;
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        return false;
                    }
                }
            }
        }
예제 #2
0
        public bool InsertServicii(int id_l, int id_s, DateTime data, bool check, int code)
        {
            if (code == 0)
                return false;
            using (var context = new ServiciiATMContext())
            {
                var serv = new Servicii
                {
                    ID_ls = id_l,
                    ID_S = id_s,
                    Data = data,
                    Check = check
                };
                context.Serviciis.Add(serv);
                context.Entry(serv).State = System.Data.Entity.EntityState.Added;
                context.SaveChanges();

                return true;
            }
        }