Пример #1
0
        /// <summary>
        /// 通过Id获取职位加急信息进行编辑或修改
        /// </summary>
        public async Task <GetJobUrgentForEditOutput> GetJobUrgentForEditAsync(int jobid, string JobName)
        {
            var output = new GetJobUrgentForEditOutput();

            JobUrgentEditDto jobUrgentEditDto;

            if (jobid != 0)
            {
                //var entity = await _jobUrgentRepository.GetAsync(input.Id.Value);
                var entity = await _jobUrgentRepository.FirstOrDefaultAsync(t => t.JobId == jobid);

                jobUrgentEditDto = entity.MapTo <JobUrgentEditDto>();
            }
            else
            {
                jobUrgentEditDto              = new JobUrgentEditDto();
                jobUrgentEditDto.UrgentDate   = DateTime.Now;
                jobUrgentEditDto.UrgentLength = 30;

                jobUrgentEditDto.State    = 1;
                jobUrgentEditDto.isDelete = false;
            }
            jobUrgentEditDto.JobName = JobName;
            output.JobUrgent         = jobUrgentEditDto;
            var UrgentTypeList = _dictionaryRepository.GetAll().Where(t => t.ParentCode == "003").ToList();

            output.UrgentTypes = UrgentTypeList.Select(c => new ComboboxItemDto(c.value, c.Name)
            {
                IsSelected = output.JobUrgent.UrgentType == c.value
            }).ToList();
            return(output);
        }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="output"></param>
 public CreateOrEditJobUrgentModalViewModel(GetJobUrgentForEditOutput output)
 {
     output.MapTo(this);
 }