/// <summary> /// 新增 /// </summary> public NoticeDepJobEditDto CreateNoticeDepJob(NoticeDepJobEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = input.MapTo <NoticeDepJob>(); entity = _NoticeDepJobRepository.Insert(entity); return(entity.MapTo <NoticeDepJobEditDto>()); }
/// <summary> /// 编辑 /// </summary> public void UpdateNoticeDepJob(NoticeDepJobEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = _NoticeDepJobRepository.Get(input.Id.Value); input.MapTo(entity); _NoticeDepJobRepository.Update(entity); }
public ActionResult Set(int nId, int type, int bId) { var nDate = nService.GetNoticeById(new EntityDto <long>() { Id = nId }); //公告数据 if (nDate != null && type >= 0 && bId > 0) { var boundData = ndjService.GetCDJByNIdOrTypeId(Convert.ToInt32(nDate.Id), bId);//绑定的数据 if (boundData != null) { return(Warn("已经设置到了公告")); } var create = new NoticeDepJobEditDto();//实例化对象Bound对象 create.NoticeId = Convert.ToInt32(nDate.Id); create.NoticetTitle = nDate.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; } ndjService.CreateNoticeDepJob(create); } return(Success()); }
/// <summary> /// 通过Id获取信息进行编辑或修改 /// </summary> public GetNoticeDepJobForEditOutput GetNoticeDepJobForEdit(NullableIdDto <long> input) { var output = new GetNoticeDepJobForEditOutput(); NoticeDepJobEditDto NoticeDepJobEditDto; if (input.Id.HasValue) { var entity = _NoticeDepJobRepository.Get(input.Id.Value); NoticeDepJobEditDto = entity.MapTo <NoticeDepJobEditDto>(); } else { NoticeDepJobEditDto = new NoticeDepJobEditDto(); } output.NoticeDepJob = NoticeDepJobEditDto; return(output); }