Exemplo n.º 1
0
        public IActionResult UpdateStorageArea(Guid siteId, Guid areaId, [FromBody] StorageAreaUpdateRequest storageAreaUpdateRequest)
        {
            if (siteId == null || areaId == null || storageAreaUpdateRequest == null ||
                string.IsNullOrWhiteSpace(storageAreaUpdateRequest.Name))
            {
                return(HandleBadRequest("A valid storage site ID, area ID and name have to be supplied."));
            }

            try
            {
                StorageArea area = LocationsService.UpdateStorageArea(siteId, areaId, storageAreaUpdateRequest.Name);
                return(Ok(area));
            }
            catch (StorageSiteNotFoundException exception)
            {
                return(HandleResourceNotFoundException(exception));
            }
            catch (StorageAreaNotFoundException exception)
            {
                return(HandleResourceNotFoundException(exception));
            }
            catch (Exception exception)
            {
                return(HandleUnexpectedException(exception));
            }
        }