public ActionResult BeginApply(Guid id) { ApplyStateEntity applyStateEntity = applyStateReposity.ApplyStates.FirstOrDefault(a => a.StudentID == id); if (applyStateEntity == null) { applyStateEntity = new ApplyStateEntity { StudentID = id }; applyStateReposity.SaveApplyState(applyStateEntity); return(RedirectToAction("Familiar", new { id = id })); } else { #region swith to current state switch (applyStateEntity.CurrentState) { case "Familiar": //检测了解期 return(RedirectToAction("Familiar", new { id = applyStateEntity.StudentID })); case "Actplan": //检测活动策划期 if (applyStateEntity.IsActplanDone == false && applyStateEntity.IsFamiliarDone) { return(RedirectToAction("Actplan", new { id = applyStateEntity.StudentID })); } else { return(RedirectToAction("Familiar", new { id = applyStateEntity.StudentID })); } case "ApplyBegin": //检测申请初期 if (applyStateEntity.IsBeginingDone == false && applyStateEntity.IsFamiliarDone && applyStateEntity.IsActplanDone) { return(RedirectToAction("ApplyBegin", new { id = applyStateEntity.StudentID })); } else { return(RedirectToAction("Familiar", new { id = applyStateEntity.StudentID })); } case "ApplyMiddle": //检测申请中期 if (applyStateEntity.IsMiddleDone == false && applyStateEntity.IsBeginingDone && applyStateEntity.IsFamiliarDone && applyStateEntity.IsActplanDone) { return(RedirectToAction("ApplyMiddle", new { id = applyStateEntity.StudentID })); } else { return(RedirectToAction("Familiar", new { id = applyStateEntity.StudentID })); } case "ApplyLast": //检测申请后期 if (applyStateEntity.IsLateDone == false && applyStateEntity.IsMiddleDone && applyStateEntity.IsBeginingDone && applyStateEntity.IsFamiliarDone && applyStateEntity.IsActplanDone) { return(RedirectToAction("ApplyLast", new { id = applyStateEntity.StudentID })); } else { return(RedirectToAction("Familiar", new { id = applyStateEntity.StudentID })); } default: return(RedirectToAction("Familiar", new { id = applyStateEntity.StudentID })); } #endregion } }