public ActionResult DeleteConfirmed(int id) { TALENTO tALENTO = db.TALENTO.Find(id); db.TALENTO.Remove(tALENTO); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID_TALENTO,ID_RUBRO,EMAIL,PASSWORD,NOMBRE,APELLIDO,CURRICULUM")] TALENTO tALENTO) { if (ModelState.IsValid) { db.Entry(tALENTO).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", "Talento", new { id = tALENTO.ID_TALENTO })); } ViewBag.ID_RUBRO = new SelectList(db.RUBRO, "ID_RUBRO", "DESCRIPCION", tALENTO.ID_RUBRO); return(View(tALENTO)); }
public ActionResult SearchJob() { if (IsLoggedIn()) { try { var talentoId = Request.QueryString["tid"]; var empresaId = Request.QueryString["eid"]; if (empresaId != "-1") { using (var db = new TalenterEntities1()) { db.Database.ExecuteSqlCommand("INSERT INTO DBO.VISITADOS(ID_EMPRESA, ID_TALENTO) VALUES (@emp, @tal)", new SqlParameter("@emp", empresaId), new SqlParameter("@tal", talentoId)); } } } catch (Exception e) { Console.WriteLine(e.Message); } EMPRESA empresa = null; using (var db = new TalenterEntities1()) { Talento = db.TALENTO.SqlQuery("SELECT * FROM TALENTO WHERE ID_Talento = @id", new SqlParameter("@id", Session["UserId"])).FirstOrDefault(); empresa = db.EMPRESA.SqlQuery(@"SELECT TOP 1 E.* FROM EMPRESA E JOIN TALENTO T ON E.ID_RUBRO = T.ID_RUBRO WHERE E.ID_EMPRESA NOT IN ( SELECT v.ID_EMPRESA FROM Visitados v JOIN Talento t ON v.ID_Talento = t.ID_Talento JOIN EMPRESA E ON V.ID_EMPRESA = E.ID_EMPRESA WHERE t.ID_Talento = @id) AND T.ID_TALENTO = @id", new SqlParameter("@id", Talento.ID_TALENTO)).FirstOrDefault(); if (empresa == null) { empresa = new EMPRESA { ID_EMPRESA = -1, NOMBRE = "Ya no hay mas empresas!", ABOUT = "Ya visitaste todas las empresas de tu rubro! Espera a que aparezcan mas!", RUBRO = Talento.RUBRO }; } Session["eid"] = empresa.ID_EMPRESA; } return(View(empresa)); } return(RedirectToAction("Login")); }
public ActionResult Create([Bind(Include = "ID_TALENTO,ID_RUBRO,EMAIL,PASSWORD,NOMBRE,APELLIDO,CURRICULUM")] TALENTO tALENTO) { if (ModelState.IsValid) { db.TALENTO.Add(tALENTO); db.SaveChanges(); return(RedirectToAction("Login", "Account")); } ViewBag.ID_RUBRO = new SelectList(db.RUBRO, "ID_RUBRO", "DESCRIPCION", tALENTO.ID_RUBRO); return(View(tALENTO)); }
// GET: Talento/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TALENTO tALENTO = db.TALENTO.Find(id); if (tALENTO == null) { return(HttpNotFound()); } return(View(tALENTO)); }
// GET: Talento/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TALENTO tALENTO = db.TALENTO.Find(id); if (tALENTO == null) { return(HttpNotFound()); } ViewBag.ID_RUBRO = new SelectList(db.RUBRO, "ID_RUBRO", "DESCRIPCION", tALENTO.ID_RUBRO); return(View(tALENTO)); }
public ActionResult Login(TALENTO model, string returnUrl) { using (TalenterEntities1 DB = new TalenterEntities1()) { var user = DB.TALENTO.Where(x => x.EMAIL == model.EMAIL && x.PASSWORD == model.PASSWORD).FirstOrDefault(); if (user != null) { Session["UserId"] = user.ID_TALENTO; Session["Email"] = user.EMAIL; Session["Name"] = user.NOMBRE; Talento = user; return(RedirectToAction("SearchJob")); } else { ModelState.AddModelError("", "Username or Password is Incorrect"); return(View()); } } }