Beispiel #1
0
 public static DiluicaoAmostra Map(DiluicaoAmostra diluicaoAmostra, DilutionSampleDto dilutionSampleDto)
 {
     diluicaoAmostra.Id             = dilutionSampleDto.Id;
     diluicaoAmostra.Homogeneizador = dilutionSampleDto.Homogenizer;
     diluicaoAmostra.Micropipeta    = dilutionSampleDto.Micropipette;
     diluicaoAmostra.Pipeta         = dilutionSampleDto.Pipette;
     diluicaoAmostra.Agitador       = dilutionSampleDto.Shaker;
     diluicaoAmostra.Placa          = dilutionSampleDto.Board;
     diluicaoAmostra.Outros         = dilutionSampleDto.Others;
     diluicaoAmostra.AguaDiluicaos  = new List <AguaDiluicao>();
     diluicaoAmostra.Ponteiras      = new List <Ponteira>();
     diluicaoAmostra.Local          = (int)dilutionSampleDto.Location.Code;
     foreach (var x in dilutionSampleDto.Points)
     {
         var ponteira = new Ponteira();
         ponteira.Codigo = (int)x.Code;
         ponteira.Valor  = x.Value;
         diluicaoAmostra.Ponteiras.Add(ponteira);
     }
     foreach (var x in dilutionSampleDto.WaterDilutions)
     {
         var aguadiluicao = new AguaDiluicao();
         aguadiluicao.Codigo = (int)x.Code;
         aguadiluicao.Valor  = x.Value;
         diluicaoAmostra.AguaDiluicaos.Add(aguadiluicao);
     }
     return(diluicaoAmostra);
 }
        public static DilutionSampleDto Map(DilutionSampleDto dilutionSampleDto, DiluicaoAmostra diluicaoAmostra)
        {
            dilutionSampleDto.Id             = diluicaoAmostra.Id;
            dilutionSampleDto.Homogenizer    = diluicaoAmostra.Homogeneizador;
            dilutionSampleDto.Micropipette   = diluicaoAmostra.Micropipeta;
            dilutionSampleDto.Pipette        = diluicaoAmostra.Pipeta;
            dilutionSampleDto.Shaker         = diluicaoAmostra.Agitador;
            dilutionSampleDto.Board          = diluicaoAmostra.Placa;
            dilutionSampleDto.Others         = diluicaoAmostra.Outros;
            dilutionSampleDto.WaterDilutions = new List <WaterDilutionDto>();
            dilutionSampleDto.Points         = new List <PointDto>();
            dilutionSampleDto.Sample         = AmostraMapToSampleDto.Map(new SampleDto(), diluicaoAmostra.fkAmostra);
            foreach (var x in diluicaoAmostra.Ponteiras)
            {
                var point = new PointDto((EnumPoints)x.Codigo);
                point.Value = (int)x.Valor;
                dilutionSampleDto.Points.Add(point);
            }
            foreach (var x in diluicaoAmostra.AguaDiluicaos)
            {
                var waterDilution = new WaterDilutionDto((EnumWaterDilution)x.Codigo);
                waterDilution.Value = (int)x.Valor;
                dilutionSampleDto.WaterDilutions.Add(waterDilution);
            }


            return(dilutionSampleDto);
        }
Beispiel #3
0
        public async Task <DilutionSampleDto> Execute(DilutionSampleDto dilutionSampleDto)
        {
            DiluicaoAmostra diluicaoAmostra = DilutionSampleDtoMapToDiluicaoAmostra.Map(new DiluicaoAmostra(), dilutionSampleDto);

            if (diluicaoAmostra == null)
            {
                throw new AppError("Informe uma solicitação válida.");
            }
            _diluicaoAmostraRepository.Save(diluicaoAmostra);
            await _diluicaoAmostraRepository.Commit();

            return(dilutionSampleDto);
        }
Beispiel #4
0
 public IActionResult OnGet()
 {
     _dilutionSampleDto        = new DilutionSampleDto();
     _dilutionSampleDto.Points = new List <PointDto>();
     _dilutionSampleDto.Points.Add(new PointDto(EnumPoints.P1));
     _dilutionSampleDto.Points.Add(new PointDto(EnumPoints.P2));
     _dilutionSampleDto.Points.Add(new PointDto(EnumPoints.P3));
     _locations = new List <LocationDto>();
     _locations.Add(new LocationDto(EnumLocal.Sala1));
     _locations.Add(new LocationDto(EnumLocal.Sala2));
     _locations.Add(new LocationDto(EnumLocal.Sala3));
     _dilutionSampleDto.WaterDilutions = new List <WaterDilutionDto>();
     _dilutionSampleDto.WaterDilutions.Add(new WaterDilutionDto(EnumWaterDilution.ML225));
     _dilutionSampleDto.WaterDilutions.Add(new WaterDilutionDto(EnumWaterDilution.ML9));
     return(Page());
 }
Beispiel #5
0
        public async Task <DilutionSampleDto> Execute(DilutionSampleDto dilutionSampleDto, int?sampleId)
        {
            if (sampleId <= 0)
            {
                throw new AppError("Informe uma solicitação válida.");
            }
            Amostra amostra = await _AmostraRepository.GetByID((int)sampleId);

            if (amostra == null)
            {
                throw new AppError("Informe uma solicitação válida.");
            }
            DiluicaoAmostra diluicaoAmostra = DilutionSampleDtoMapToDiluicaoAmostra.Map(new DiluicaoAmostra(), dilutionSampleDto);

            diluicaoAmostra.fkAmostra   = amostra;
            diluicaoAmostra.fkAmostraId = amostra.Id;
            _DiluicaoAmostraRepository.Insert(diluicaoAmostra);
            await _DiluicaoAmostraRepository.Commit();

            dilutionSampleDto.Id = diluicaoAmostra.Id;
            return(dilutionSampleDto);
        }
Beispiel #6
0
        public async Task <IActionResult> Update([FromBody] DilutionSampleDto dilutionSampleDto)
        {
            dilutionSampleDto = await _updateDilutionSampleService.Execute(dilutionSampleDto);

            return(Ok(new ResponseDto("success", dilutionSampleDto)));
        }
Beispiel #7
0
        public async Task <IActionResult> Create([FromBody] DilutionSampleDto DilutionSampleDto, int?sampleId)
        {
            DilutionSampleDto = await _createDilutionSampleService.Execute(DilutionSampleDto, sampleId);

            return(Ok(new ResponseDto("success", DilutionSampleDto)));
        }
Beispiel #8
0
 public ExperimentDto()
 {
     DilutionSample = new DilutionSampleDto();
 }