public ActionResult Delete(int id, Candidate collection) { try { // TODO: Add delete logic here Candidate obj = db.Candidate.FirstOrDefault(c => c.CandidateId == id); db.Candidate.Remove(obj); db.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(Candidate candidates) { try { candidates.DispositionId = 1; candidates.RatingId = 1; candidates.DateCreated = DateTime.Now; candidates.LastUpdated = DateTime.Now; candidates.RecruiterId = 2; candidates.WorkflowId = 1; db.Candidate.Add(candidates); db.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult CompanyAdd(Candidate collection) { return Json(new { success = true }); }
public ActionResult Edit(int id, Candidate collection) { try { collection.LastUpdated = DateTime.Now; db.Candidate.Attach(collection); db.Entry(collection).State = System.Data.EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } catch (Exception ex) { ViewBag.ErroAtualizar = "Erro ao atualizar o candidato!"; return View(db.Candidate.FirstOrDefault(x =>x.CandidateId == id)); } }