public async Task <BaseResponse <ComputerDto> > CreateComputer(CreateComputer request) { var(errors, isValid) = EntityValidator.Validate(request); if (!isValid) { return(new BaseResponse <ComputerDto>((int)CustomHttpStatusCode.UnprocessableEntity, string.Join("", errors))); } var computer = new ComputerBuilder().CreateComputer(request.Name, request.Price) .WithGraphicsCards(_mapper.Map <IEnumerable <Domain.GraphicsCard> >(request.GraphicsCard)) .WithRams(_mapper.Map <IEnumerable <Ram> >(request.Ram)) .Build(); await _computerRepository.Create(computer); var computerDto = _mapper.Map <ComputerDto>(computer); return(new BaseResponse <ComputerDto>((int)HttpStatusCode.Created, computerDto)); }