public IActionResult Excluir(int id) { var caminhao = _crudContext.Caminhao.Single(p => p.Id == id); _crudContext.Remove(caminhao); _crudContext.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Create(Employee employee) { if (ModelState.IsValid) { _context.Employees.Add(employee); _context.SaveChanges(); return(RedirectToAction("Index", "Home")); } return(View(employee)); }
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)); }
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(); }
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(); } }
public void Guncelle(Calisan calisan) { using (CrudDbContext db = new CrudDbContext()) { db.Entry(calisan).State = EntityState.Modified; db.SaveChanges(); } }
public void Sil(int id) { using (CrudDbContext db = new CrudDbContext()) { var silinecekKullanici = db.Login.Find(id); db.Login.Remove(silinecekKullanici); db.SaveChanges(); } }
public ActionResult Edit(int id, Person person) { using(CrudDbContext db = new CrudDbContext()) { db.Entry(person).State = EntityState.Modified; db.SaveChanges(); } return RedirectToAction("Index"); }
public void Sil(int id) { using (CrudDbContext db = new CrudDbContext()) { var silinecekCalisan = db.Calisan.Find(id); db.Calisan.Remove(silinecekCalisan); db.SaveChanges(); } }
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"); }
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(); } }
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(); } }
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(); } }
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(); } }
public void Ekle(T entity) { dbSet.Add(entity); db.SaveChanges(); }