public ActionResult ExperienciaLaboral(string inicio, string fin, exp_profesional exp) { usuarios us = (usuarios)Session["usuario"]; curriculum an = model.idCurriculum(us.id_usuario); ViewBag.FormA = model6.ListaExp(an.id_curriculum); ViewBag.Form = model5.List(); if (inicio.Length == 0 || fin.Length == 0) { ViewBag.errorB = "Ingrese las Fechas"; return(View()); } exp.fech_inicio = Convert.ToDateTime(inicio); exp.fech_fin = Convert.ToDateTime(fin); try { if (ModelState.IsValid) { if (model5.Insert(exp) > 0) { cv_exp_laboral bell = new cv_exp_laboral(); bell.id_curriculum = an.id_curriculum; bell.id_exp_profesional = exp.id_exp_profesional; if (model6.Insert(bell) > 0) { ViewBag.errorB = "Experiencia Profesional Ingresado"; return(RedirectToAction("ExperienciaLaboral")); } ViewBag.errorB = "ERROR3"; return(View()); } ViewBag.errorB = "ERROR2"; return(View()); } else { ViewBag.errorB = "ERROR"; return(View()); } } catch { return(View()); } }
public ActionResult ExperienciaLaboral(int?id) { usuarios us = (usuarios)Session["usuario"]; curriculum an = model.idCurriculum(us.id_usuario); ViewBag.FormA = model6.ListaExp(an.id_curriculum); ViewBag.Form = model5.List(); if (id == null) { return(View("ExperienciaLaboral")); } int idExp = Convert.ToInt32(id); cv_exp_laboral obj = model6.ObjetoExp(an.id_curriculum, idExp); try { if (obj == null) { return(View("ExperienciaLaboral")); } else { int x = obj.id_exp_profesional; if (model6.Remove(obj.id_cv_exp_laboral) > 0) { if (model5.Remove(x) > 0) { return(RedirectToAction("ExperienciaLaboral")); } } ViewBag.errorB = "ERROR: AL ELIMINAR LA EXPERIENCIA"; return(View("ExperienciaLaboral")); } } catch { ViewBag.errorB = "ERROR: AL ELIMINAR la experiencia"; return(View("ExperienciaLaboral")); } }