示例#1
0
        public IActionResult Excluir(int id)
        {
            var caminhao = _crudContext.Caminhao.Single(p => p.Id == id);

            _crudContext.Remove(caminhao);
            _crudContext.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
0
 public IActionResult Create(Employee employee)
 {
     if (ModelState.IsValid)
     {
         _context.Employees.Add(employee);
         _context.SaveChanges();
         return(RedirectToAction("Index", "Home"));
     }
     return(View(employee));
 }
示例#3
0
        public ActionResult Create([Bind(Include = "userID,first_name,last_name,date,gender,mobile,email,pswd,category")] User user)
        {
            if (ModelState.IsValid)
            {
                db.Users.Add(user);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(user));
        }
示例#4
0
        public void AddPersonne(Personne p)
        {
            var id       = _crudDbContext.Personnes.Max(p => p.PersonneId);
            var personne = new Personne
            {
                Nom        = p.Nom,
                Prenom     = p.Prenom,
                Adresse    = p.Adresse,
                CodePostal = p.CodePostal,
                Ville      = p.Ville,
                Mail       = p.Mail,
                Telephone  = p.Telephone
            };

            _crudDbContext.Add(personne);
            _crudDbContext.SaveChanges();
        }
示例#5
0
 public void inserir(Plano plano)
 {
     using (var context = new CrudDbContext())
     {
         context.Planos.Add(plano);
         context.SaveChanges();
     }
 }
 public void Atualizar(ClassificacaoPlano entidade)
 {
     using (var context = new CrudDbContext())
     {
         context.ClassificacaoPlano.Remove(entidade);
         context.SaveChanges();
     }
 }
 public void inserir(ClassificacaoPlano entidade)
 {
     using (var context = new CrudDbContext())
     {
         context.ClassificacaoPlano.Add(entidade);
         context.SaveChanges();
     }
 }
 public void inserir(CoberturaPlano cobertura)
 {
     using (var context = new CrudDbContext())
     {
         context.CoberturaPlano.Add(cobertura);
         context.SaveChanges();
     }
 }
 public void Atualizar(CoberturaPlano entidade)
 {
     using (var context = new CrudDbContext())
     {
         context.CoberturaPlano.Update(entidade);
         context.SaveChanges();
     }
 }
 public void Deletar(CoberturaPlano entidade)
 {
     using (var context = new CrudDbContext())
     {
         context.CoberturaPlano.Remove(entidade);
         context.SaveChanges();
     }
 }
示例#11
0
 public void Guncelle(Calisan calisan)
 {
     using (CrudDbContext db = new CrudDbContext())
     {
         db.Entry(calisan).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
示例#12
0
 public void Sil(int id)
 {
     using (CrudDbContext db = new CrudDbContext())
     {
         var silinecekKullanici = db.Login.Find(id);
         db.Login.Remove(silinecekKullanici);
         db.SaveChanges();
     }
 }
示例#13
0
 public ActionResult Edit(int id, Person person)
 {
     using(CrudDbContext db = new CrudDbContext())
     {
         db.Entry(person).State = EntityState.Modified;
         db.SaveChanges();
     }
     return RedirectToAction("Index");
 }
示例#14
0
 public void Sil(int id)
 {
     using (CrudDbContext db = new CrudDbContext())
     {
         var silinecekCalisan = db.Calisan.Find(id);
         db.Calisan.Remove(silinecekCalisan);
         db.SaveChanges();
     }
 }
示例#15
0
 public ActionResult Delete(int id,Person person)
 {
     using (CrudDbContext db = new CrudDbContext())
     {
        person = db.People.Where(x => x.Id == id).FirstOrDefault();
         db.People.Remove(person);
         db.SaveChanges();
     }
     return RedirectToAction("Index");
 }
示例#16
0
        public ActionResult Create(Person person)
        {
            using(CrudDbContext db = new CrudDbContext())
            {
                 db.People.Add(person);
                 db.SaveChanges();
            }
            return RedirectToAction("Index");

        }
        public void Deletar(int id)
        {
            var coberturaPlano = new CoberturaPlano()
            {
                Id = id
            };

            using (var context = new CrudDbContext())
            {
                context.CoberturaPlano.Remove(coberturaPlano);
                context.SaveChanges();
            }
        }
        public void Deletar(int id)
        {
            var classificacao = new ClassificacaoPlano()
            {
                Id = id
            };

            using (var context = new CrudDbContext())
            {
                context.ClassificacaoPlano.Remove(classificacao);
                context.SaveChanges();
            }
        }
示例#19
0
        public void Deletar(int idPlano)
        {
            var planos = new Plano()
            {
                Id = idPlano
            };


            using (var context = new CrudDbContext())
            {
                context.Remove(planos);
                context.SaveChanges();
            }
        }
 public void Kaydet(Departman departman)
 {
     using (CrudDbContext db = new CrudDbContext())
     {
         if (departman.Id == 0)
         {
             db.Departman.Add(departman);
         }
         else
         {
             var guncellenecekDepartman = db.Departman.Find(departman.Id);
             if (guncellenecekDepartman == null)
             {
                 return;
             }
             guncellenecekDepartman.Ad = departman.Ad;
         }
         db.SaveChanges();
     }
 }
示例#21
0
 public void Kaydet(Login login)
 {
     using (CrudDbContext db = new CrudDbContext())
     {
         if (login.Id == 0)
         {
             db.Login.Add(login);
         }
         else
         {
             var guncellenecekKullanici = db.Login.Find(login.Id);
             if (guncellenecekKullanici == null)
             {
                 return;
             }
             guncellenecekKullanici.KullaniciAdi = login.KullaniciAdi;
             guncellenecekKullanici.Sifre        = login.Sifre;
         }
         db.SaveChanges();
     }
 }
示例#22
0
 public void Kaydet(Calisan calisan)
 {
     using (CrudDbContext db = new CrudDbContext())
     {
         if (calisan.Id == 0)
         {
             db.Calisan.Add(calisan);
         }
         else
         {
             var guncellenecekCalisan = db.Calisan.Find(calisan.Id);
             if (guncellenecekCalisan == null)
             {
                 return;
             }
             guncellenecekCalisan.Ad          = calisan.Ad;
             guncellenecekCalisan.Soyad       = calisan.Soyad;
             guncellenecekCalisan.Maas        = calisan.Maas;
             guncellenecekCalisan.departmanId = calisan.departmanId;
         }
         db.SaveChanges();
     }
 }
示例#23
0
 public void Ekle(T entity)
 {
     dbSet.Add(entity);
     db.SaveChanges();
 }