Example #1
0
        public PartialViewResult Edit(long id = 0)
        {
            RecruitmentSkill entity = recruitmentSkillService.GetById(id) ?? new RecruitmentSkill();
            var groupSkillIds       = entity.Skills.ToListNumber <long>(',').Cast <object>().ToList();
            RecruitmentKillEditViewModel viewModel = new RecruitmentKillEditViewModel()
            {
                Id          = entity.Id,
                Title       = entity.Title,
                Skills      = entity.Skills.ToListNumber <long>(',').ToArray(),
                GroupSkills = recruitmentSkillDetailService.GetDropDownMultiple("Name", "Id", groupSkillIds)
            };

            return(PartialView("_EditPartial", viewModel));
        }
Example #2
0
        public JsonResult Save(RecruitmentKillEditViewModel model)
        {
            JsonResultBO result = new JsonResultBO(true);

            try
            {
                if (ModelState.IsValid)
                {
                    if (model.Id == 0)
                    {
                        RecruitmentSkill entity = new RecruitmentSkill()
                        {
                            Title  = model.Title,
                            Skills = string.Join(",", model.Skills)
                        };
                        recruitmentSkillService.Create(entity);
                        logger.InfoFormat("Thêm mới nhóm kỹ năng {0}", model.Title);
                    }
                    else
                    {
                        RecruitmentSkill entity = recruitmentSkillService.GetById(model.Id);
                        entity.Title  = model.Title;
                        entity.Skills = string.Join(",", model.Skills);
                        recruitmentSkillService.Update(entity);

                        logger.InfoFormat("Cập nhật nhóm kỹ năng {0}", model.Title);
                    }
                }
                else
                {
                    result.Status  = false;
                    result.Message = ModelState.GetErrors();
                }
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = "Không thể cập nhật nhóm kỹ năng";
                logger.Error("Lỗi cập nhật nhóm kỹ năng", ex);
            }
            return(Json(result));
        }