Exemple #1
0
        public ActionResult Details(int?id = null)
        {
            var vm = new ContactDepViewModel()
            {
                departamento = storeDB.TB_DEPARTAMENTO.ToList().Where(d => d.COD_DEP == id).FirstOrDefault(),
                contacto     = storeDB.TB_CONTACTO.ToList().Where(d => d.COD_DEP == id).FirstOrDefault()
            };

            return(View(vm));
        }
Exemple #2
0
 public ActionResult Contacto(ContactDepViewModel reg)
 {
     try
     {
         storeDB.TB_CONTACTO.Add(reg.contacto);
         storeDB.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return(RedirectToAction("Details", "Home", new { id = reg.contacto.COD_DEP }));
 }