Esempio n. 1
0
        public CustomerGrouping ConvertDTOToEntity(CustomerGroupingDetail_CustomerGroupingDTO CustomerGroupingDetail_CustomerGroupingDTO)
        {
            CustomerGrouping CustomerGrouping = new CustomerGrouping();

            CustomerGrouping.Id   = CustomerGroupingDetail_CustomerGroupingDTO.Id;
            CustomerGrouping.Name = CustomerGroupingDetail_CustomerGroupingDTO.Name;
            return(CustomerGrouping);
        }
Esempio n. 2
0
        public async Task <CustomerGroupingDetail_CustomerGroupingDTO> Get([FromBody] CustomerGroupingDetail_CustomerGroupingDTO CustomerGroupingDetail_CustomerGroupingDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new MessageException(ModelState);
            }

            CustomerGrouping CustomerGrouping = await CustomerGroupingService.Get(CustomerGroupingDetail_CustomerGroupingDTO.Id);

            return(new CustomerGroupingDetail_CustomerGroupingDTO(CustomerGrouping));
        }
Esempio n. 3
0
        public async Task <ActionResult <CustomerGroupingDetail_CustomerGroupingDTO> > Delete([FromBody] CustomerGroupingDetail_CustomerGroupingDTO CustomerGroupingDetail_CustomerGroupingDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new MessageException(ModelState);
            }

            CustomerGrouping CustomerGrouping = ConvertDTOToEntity(CustomerGroupingDetail_CustomerGroupingDTO);

            CustomerGrouping = await CustomerGroupingService.Delete(CustomerGrouping);

            CustomerGroupingDetail_CustomerGroupingDTO = new CustomerGroupingDetail_CustomerGroupingDTO(CustomerGrouping);
            if (CustomerGrouping.IsValidated)
            {
                return(CustomerGroupingDetail_CustomerGroupingDTO);
            }
            else
            {
                return(BadRequest(CustomerGroupingDetail_CustomerGroupingDTO));
            }
        }