public async Task <ActionResult <LookupCodeDto> > Find(int id)
        {
            var entity = await _service.Find(id);

            if (entity == null)
            {
                return(NotFound());
            }
            return(Ok(entity.Adapt <LookupCodeDto>()));
        }
Пример #2
0
        public async Task <ActionResult <LookupCodeDto> > UnExpire(int id)
        {
            var entity = await ManageTypesService.Find(id);

            if (entity == null)
            {
                return(NotFound());
            }
            if (!PermissionDataFiltersExtensions.HasAccessToLocation(User, Db, entity.LocationId))
            {
                return(Forbid());
            }

            var lookupCode = await ManageTypesService.Unexpire(id);

            return(Ok(lookupCode.Adapt <LookupCodeDto>()));
        }
Пример #3
0
        public async Task <ActionResult <LookupCodeDto> > Update(LookupCodeDto lookupCodeDto)
        {
            if (lookupCodeDto == null)
            {
                return(BadRequest(InvalidLookupCodeError));
            }
            var entity = await ManageTypesService.Find(lookupCodeDto.Id);

            if (entity == null)
            {
                return(NotFound());
            }
            if (!PermissionDataFiltersExtensions.HasAccessToLocation(User, Db, lookupCodeDto.LocationId))
            {
                return(Forbid());
            }

            var lookupCode       = lookupCodeDto.Adapt <LookupCode>();
            var lookupCodeResult = await ManageTypesService.Update(lookupCode);

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