public async Task <ActionResult <IEnumerable <AcStaffDto> > > GetAcStaffById(int id) { MessageModel <AcStaffDto> res = new MessageModel <AcStaffDto>(); if (!await _acStaffServices.ExistEntityAsync(a => a.Id == id)) { return(NotFound(StyleCode.NotFound(res))); } AcStaff entity = await _acStaffServices.GetEntityByIdAsync(id); res.Data = _mapper.Map <AcStaffDto>(entity); return(Ok(res)); }
public async Task <ActionResult <MessageModel <PrProductTaskDto> > > AddPrProductTask(PrProductTaskAddDto prProductTaskAddDto) { string uid = HttpContext.User.Claims.FirstOrDefault(c => c.Type == "id")?.Value; var userentity = await _acUserInfoServices.GetEntityByIdAsync(int.Parse(uid)); var staffentity = await _acStaffServices.GetEntityByIdAsync(int.Parse(userentity.StaffId.ToString())); var res = new MessageModel <PrProductTaskDto>(); prProductTaskAddDto.Batch = DateTime.Now.ToString("yyyyMMddHHmmss"); prProductTaskAddDto.OperatorId = userentity.StaffId; prProductTaskAddDto.OperateTime = DateTime.Now; prProductTaskAddDto.DepartmentId = staffentity.DepartmentId; prProductTaskAddDto.Status = 0; var entity = _mapper.Map <PrProductTask>(prProductTaskAddDto); await _prProductTaskServices.AddEntityAsync(entity); res.Data = _mapper.Map <PrProductTaskDto>(entity); return(Ok(res)); }