public async Task <ActionResult <LookupCodeDto> > Add(LookupCodeDto lookupCodeDto)
        {
            if (lookupCodeDto == null)
            {
                throw new BadRequestException("Invalid lookupCode.");
            }

            var entity     = lookupCodeDto.Adapt <LookupCode>();
            var lookupCode = await _service.Add(entity);

            return(Ok(lookupCode.Adapt <LookupCodeDto>()));
        }
Example #2
0
        public async Task <ActionResult <LookupCodeDto> > Add(AddLookupCodeDto lookupCodeDto)
        {
            if (lookupCodeDto == null)
            {
                return(BadRequest(InvalidLookupCodeError));
            }
            if (!PermissionDataFiltersExtensions.HasAccessToLocation(User, Db, lookupCodeDto.LocationId))
            {
                return(Forbid());
            }

            var lookupCode = await ManageTypesService.Add(lookupCodeDto);

            return(Ok(lookupCode.Adapt <LookupCodeDto>()));
        }