public ActionResult Create(Empresa model) { try { using (var ctx = new GDentalContext()) { ctx.Empresas.Add(model); ctx.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Funcao_Usuario model) { try { using (var ctx = new GDentalContext()) { ctx.FuncaoUsuario.Add(model); ctx.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Tipo_Documento model) { try { using (var ctx = new GDentalContext()) { ctx.TipoDocumentos.Add(model); ctx.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public Form1() { InitializeComponent(); using (var ctx = new GDentalContext()) { Empresa emp = new Empresa() { ChaveApi = "", Cnpj = "83.756.386/0001-93", CroResponsavel = "123456", FimExpediente = "18:00", InicioExpediente = "08:00", NomeFantasia = "Dentitas SA", RazaoSocial = "Dentistas SA" }; ctx.Empresas.Add(emp); ctx.SaveChanges(); } }
public ActionResult Edit(int id, Empresa model) { try { var emp = new Empresa(); using (var ctx = new GDentalContext()) { var original = ctx.Empresas.Find(id); if (original != null) { ctx.Entry(original).CurrentValues.SetValues(model); ctx.SaveChanges(); } } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Delete(int id, Tipo_Contato model) { try { var tipoContato = new Tipo_Contato(); using (var ctx = new GDentalContext()) { var original = ctx.TipoContatos.Find(id); ctx.TipoContatos.Remove(original); ctx.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(int id, Funcao_Usuario model) { try { using (var ctx = new GDentalContext()) { var original = ctx.FuncaoUsuario.Find(id); if (original != null) { ctx.Entry(original).CurrentValues.SetValues(model); ctx.SaveChanges(); } } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Delete(int id, Funcao_Usuario model) { try { using (var ctx = new GDentalContext()) { var original = ctx.FuncaoUsuario.Find(id); ctx.FuncaoUsuario.Remove(original); ctx.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(int id, Tipo_Documento model) { try { var tipoDocumento = new Tipo_Documento(); using (var ctx = new GDentalContext()) { var original = ctx.TipoDocumentos.Find(id); if (original != null) { ctx.Entry(original).CurrentValues.SetValues(model); ctx.SaveChanges(); } } return RedirectToAction("Index"); } catch { return View(); } }