Exemple #1
0
        // GET: Empresa/Details/5
        public ActionResult Details(int id)
        {
            var emp = new Empresa();
            using (var ctx = new GDentalContext())
            {
                emp = ctx.Empresas.Find(id);
            }

            return View(emp);
        }
        // GET: TipoDocumento/Details/5
        public ActionResult Details(int id)
        {
            var tipoContatos = new Tipo_Contato();
            using (var ctx = new GDentalContext())
            {
                tipoContatos = ctx.TipoContatos.Find(id);
            }

            return View(tipoContatos);
        }
        // GET: FuncaoUsuario/Details/5
        public ActionResult Details(int id)
        {
            var funcaoUsuario = new Funcao_Usuario();
            using (var ctx = new GDentalContext())
            {
                funcaoUsuario = ctx.FuncaoUsuario.Find(id);
            }

            return View(funcaoUsuario);
        }
        // GET: TipoDocumento/Edit/5
        public ActionResult Edit(int id)
        {
            try
            {
                var tipoContato = new Tipo_Contato();
                using (var ctx = new GDentalContext())
                {
                    tipoContato = ctx.TipoContatos.Find(id);
                }

                return View(tipoContato);
            }
            catch
            {
                return View();
            }
        }
        // GET: FuncaoUsuario/Edit/5
        public ActionResult Edit(int id)
        {
            try
            {
                var funcaoUsuario = new Funcao_Usuario();
                using (var ctx = new GDentalContext())
                {
                    funcaoUsuario = ctx.FuncaoUsuario.Find(id);
                }

                return View(funcaoUsuario);
            }
            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();
            }
        }
Exemple #7
0
        public ActionResult Create(Empresa model)
        {
            try
            {
                using (var ctx = new GDentalContext())
                {
                    ctx.Empresas.Add(model);
                    ctx.SaveChanges();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Exemple #8
0
        // GET: Empresa/Edit/5
        public ActionResult Edit(int id)
        {
            try
            {
                var emp = new Empresa();
                using (var ctx = new GDentalContext())
                {
                    emp = ctx.Empresas.Find(id);
                }

                return View(emp);
            }
            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 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();
            }
        }
        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();
            }
        }
Exemple #12
0
        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();
            }
        }
Exemple #13
0
        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();
            }
           
        }
        // GET: TipoDocumento/Delete/5
        public ActionResult Delete(int id)
        {
            try
            {
                var tipoDocumento = new Tipo_Documento();
                using (var ctx = new GDentalContext())
                {
                    tipoDocumento = ctx.TipoDocumentos.Find(id);
                }

                return View(tipoDocumento);
            }
            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();
            }
        }
 // GET: FuncaoUsuario
 public ActionResult Index()
 {
     var model = new GDentalContext().FuncaoUsuario.ToList();
     return View(model);
 }
 // GET: TipoDocumento
 public ActionResult Index()
 {
     var model = new GDentalContext().TipoDocumentos.ToList();
     return View(model);
 }
Exemple #18
0
 // GET: Empresa
 public ActionResult Index()
 {
     var model = new GDentalContext().Empresas.ToList();
     return View(model);
 }
        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();
            }
        }