Пример #1
0
        public JsonResult CreateEducation(string spaceKey, EducationExperienceEditModel model)
        {
            string message = string.Empty;
            if (ModelState.HasBannedWord(out message))
            {
                return Json(new StatusMessageData(StatusMessageType.Error, message));
            }

            long userId = UserIdToUserNameDictionary.GetUserId(spaceKey);

            EducationExperience education = model.AsEducationExperience(userId);
            bool result = userProfileService.CreateEducationExperience(education);
            if (result)
                return Json(new StatusMessageData(StatusMessageType.Success, "创建教育经历成功!"));
            else
                return Json(new StatusMessageData(StatusMessageType.Error, "创建教育经历失败!"));
        }
Пример #2
0
        /// <summary>
        /// 编辑教育经历页面
        /// </summary>
        public ActionResult _EditUserEducationInfo(string spaceKey, long? educationId)
        {
            User user = userService.GetFullUser(spaceKey);
            if (user == null)
                return HttpNotFound();
            ViewData["userProfile"] = userProfileService.Get(user.UserId);

            EducationExperienceEditModel editModel = new EducationExperienceEditModel();

            IList<int> startDateList = new List<int>();
            int nowYear = DateTime.Now.Year;
            for (int i = 0; i < 50; i++)
            {
                startDateList.Add(nowYear - i);
            }
            ViewData["StareYear"] = new SelectList(startDateList.Select(n => new { text = n.ToString(), value = n.ToString() }), "value", "text");

            if (educationId.HasValue && educationId > 0)
            {
                EducationExperience edu = userProfileService.GetEducationExperience(educationId.Value, user.UserId);
                if (edu != null)
                    editModel = edu.AsEditModel();
            }

            return View(editModel);
        }