/// <summary> /// 新增 /// </summary> public KnowledgeDepJobEditDto CreateKnowledgeDepJob(KnowledgeDepJobEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = input.MapTo <KnowledgeDepJob>(); entity = _KnowledgeDepJobRepository.Insert(entity); return(entity.MapTo <KnowledgeDepJobEditDto>()); }
/// <summary> /// 编辑 /// </summary> public void UpdateKnowledgeDepJob(KnowledgeDepJobEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = _KnowledgeDepJobRepository.Get(input.Id.Value); input.MapTo(entity); _KnowledgeDepJobRepository.Update(entity); }
public ActionResult Set(int kId, int type, int bId) { var kDate = kService.GetKonwledgeInfoById(new EntityDto <long>() { Id = kId }); //知识点数据 if (kDate != null && type >= 0 && bId > 0) { var boundData = kdjService.GetCDJByKIdOrTypeId(Convert.ToInt32(kDate.Id), bId);//绑定的数据 if (boundData != null) { return(Warn("已经设置到了知识点")); } var create = new KnowledgeDepJobEditDto();//实例化对象Bound对象 create.KnoledgeId = Convert.ToInt32(kDate.Id); create.KnoledgeTitle = kDate.Title; create.type = type; switch (type) { case (int)ConfigureType.Department: var department = departmentService.GetDepartmentInfoById(new EntityDto <long>() { Id = bId }); if (department != null) { create.BusinessId = bId; create.BusinessName = department.DisplayName; } break; case (int)ConfigureType.Post: var post = jobPostService.GetJobPostById(new EntityDto <long>() { Id = bId }); if (post != null) { create.BusinessId = (int)post.Id; create.BusinessName = post.Name; } break; default: break; } kdjService.CreateKnowledgeDepJob(create); } return(Success()); }
/// <summary> /// 通过Id获取信息进行编辑或修改 /// </summary> public GetKnowledgeDepJobForEditOutput GetKnowledgeDepJobForEdit(NullableIdDto <long> input) { var output = new GetKnowledgeDepJobForEditOutput(); KnowledgeDepJobEditDto KnowledgeDepJobEditDto; if (input.Id.HasValue) { var entity = _KnowledgeDepJobRepository.Get(input.Id.Value); KnowledgeDepJobEditDto = entity.MapTo <KnowledgeDepJobEditDto>(); } else { KnowledgeDepJobEditDto = new KnowledgeDepJobEditDto(); } output.KnowledgeDepJob = KnowledgeDepJobEditDto; return(output); }