public async Task <ActionResult <SpecificationViewModel> > GetByIdAsync(int id)
        {
            var existingSpecification = await _queries.FindByIdAsync(id);

            if (existingSpecification == null)
            {
                return(NotFound());
            }

            return(existingSpecification);
        }
Beispiel #2
0
        public async Task <ActionResult <DetailSpecificationViewModel> > CreateDetailSpecificationAsync(CreateDetailSpecificationCommand createDetailSpecificationCommand)
        {
            var existingSpecification = await _specificationQueries.FindByIdAsync(createDetailSpecificationCommand.SpecificationId);

            if (existingSpecification == null)
            {
                return(NotFound());
            }
            var detailSpecification = _mapper.Map <DetailSpecification>(createDetailSpecificationCommand);

            await _behavior.CreateDetailSpecificationAsync(detailSpecification);

            var detailSpecificationViewModel = await _queries.FindByIdAsync(detailSpecification.Id);

            return(detailSpecificationViewModel);
        }