public async Task <bool> AddAsync(StorageLocationCreateViewModel storageLocationViewModel) { StorageLocation storageLocation = _mapper.Map <StorageLocationCreateViewModel, StorageLocation>(storageLocationViewModel); int affectedRows = await _storageLocationRepository.AddAsync(storageLocation); if (affectedRows > 0) { return(true); } return(false); }
public async Task <IActionResult> NewStorageLocation(StorageLocationCreateViewModel storageLocation) { try { var success = await _storageLocationService.AddAsync(storageLocation); if (success) { return(Created("", storageLocation)); } return(BadRequest($"Erro ao criar local")); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex)); } }