Ejemplo n.º 1
0
        public VariationGrouping ConvertDTOToEntity(VariationGroupingDetail_VariationGroupingDTO VariationGroupingDetail_VariationGroupingDTO)
        {
            VariationGrouping VariationGrouping = new VariationGrouping();

            VariationGrouping.Id        = VariationGroupingDetail_VariationGroupingDTO.Id;
            VariationGrouping.Name      = VariationGroupingDetail_VariationGroupingDTO.Name;
            VariationGrouping.ProductId = VariationGroupingDetail_VariationGroupingDTO.ProductId;
            return(VariationGrouping);
        }
Ejemplo n.º 2
0
        public async Task <VariationGroupingDetail_VariationGroupingDTO> Get([FromBody] VariationGroupingDetail_VariationGroupingDTO VariationGroupingDetail_VariationGroupingDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new MessageException(ModelState);
            }

            VariationGrouping VariationGrouping = await VariationGroupingService.Get(VariationGroupingDetail_VariationGroupingDTO.Id);

            return(new VariationGroupingDetail_VariationGroupingDTO(VariationGrouping));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <VariationGroupingDetail_VariationGroupingDTO> > Update([FromBody] VariationGroupingDetail_VariationGroupingDTO VariationGroupingDetail_VariationGroupingDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new MessageException(ModelState);
            }

            VariationGrouping VariationGrouping = ConvertDTOToEntity(VariationGroupingDetail_VariationGroupingDTO);

            VariationGrouping = await VariationGroupingService.Update(VariationGrouping);

            VariationGroupingDetail_VariationGroupingDTO = new VariationGroupingDetail_VariationGroupingDTO(VariationGrouping);
            if (VariationGrouping.IsValidated)
            {
                return(VariationGroupingDetail_VariationGroupingDTO);
            }
            else
            {
                return(BadRequest(VariationGroupingDetail_VariationGroupingDTO));
            }
        }