public async Task <ActionResult <LookupCodeDto> > Update(LookupCodeDto lookupCodeDto) { if (lookupCodeDto == null) { throw new BadRequestException("Invalid lookupCode."); } var entity = lookupCodeDto.Adapt <LookupCode>(); var lookupCode = await _service.Update(entity); return(Ok(lookupCode.Adapt <LookupCodeDto>())); }
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>())); }