public ActionResult Create(WorkExprience workExprience) { if (ModelState.IsValid) { if (workExprience.IsCurrent && workExprience.EndDate != null) { ModelState.AddModelError("EndDate", "If you have an out-of-date date, you can not be working."); return(View(workExprience)); } if (workExprience.EndDate != null && (workExprience.EndDate <= workExprience.StartDate)) { ModelState.AddModelError("EndDate", "End Date can not be smaller then Start Date."); return(View(workExprience)); } if (workExprience.IsCurrent == false && workExprience.EndDate == null) { ModelState.AddModelError("EndDate", "End Date and Is Current can not be empty."); return(View(workExprience)); } PersonInfo pi = SessionHelper.GetCurrentPersonInfo(db); workExprience.PersonInfo = pi; db.WorkExpriences.Add(workExprience); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workExprience)); }
public ActionResult Edit(WorkExprience workExprience) { if (ModelState.IsValid) { if (workExprience.IsCurrent && workExprience.EndDate != null) { ModelState.AddModelError("EndDate", "If you have an out-of-date date, you can not be working."); return(View(workExprience)); } if (workExprience.EndDate != null && (workExprience.EndDate <= workExprience.StartDate)) { ModelState.AddModelError("EndDate", "End Date can not be smaller then Start Date."); return(View(workExprience)); } if (workExprience.IsCurrent == false && workExprience.EndDate == null) { ModelState.AddModelError("EndDate", "End Date and Is Current can not be empty."); return(View(workExprience)); } db.Entry(workExprience).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(workExprience)); }
public ActionResult WorkExperience(WorkExprience work) { try { using (var dbContext = new DataDbContext()) { if (Session["ApplicantID"] != null) { work.FkApplicantId = Convert.ToInt32(Session["ApplicantID"]); dbContext.WorkExpriences.Add(work); dbContext.SaveChanges(); ModelState.Clear(); return(RedirectToAction("Skills", "Skill")); } else { return(RedirectToAction("Expired", "Session")); } } } catch (System.Exception) { ViewBag.MessageErrorValidation = " Validation error occured!"; return(View()); } }
public ActionResult DeleteConfirmed(int id) { WorkExprience workExprience = db.WorkExpriences.Find(id); db.WorkExpriences.Remove(workExprience); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: WorkExpriences/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkExprience workExprience = db.WorkExpriences.Find(id); if (workExprience == null) { return(HttpNotFound()); } return(View(workExprience)); }
public Resume(WorkExprience work) { this.work = (WorkExprience)work.Clone();//提供Clone方法调用的私有构造函数,一边克隆“工作经历”的数据 }
public Resume(string name) { this.name = name; work = new WorkExprience(); }